mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-28 17:23:09 +03:00
Ensure nodes within contracted nodes are unselected.
This commit is contained in:
parent
5f32ac1858
commit
5aa5eb9d6f
@ -1137,6 +1137,8 @@ static nserror treeview_node_contract_cb(treeview_node *n, void *ctx,
|
||||
assert(n != NULL);
|
||||
assert(n->type != TREE_NODE_ROOT);
|
||||
|
||||
n->flags &= ~TREE_NODE_SELECTED;
|
||||
|
||||
if ((n->flags & TREE_NODE_EXPANDED) == false) {
|
||||
/* Nothing to do. */
|
||||
return NSERROR_OK;
|
||||
@ -1157,6 +1159,7 @@ static nserror treeview_node_contract_cb(treeview_node *n, void *ctx,
|
||||
/* Exported interface, documented in treeview.h */
|
||||
nserror treeview_node_contract(treeview *tree, treeview_node *node)
|
||||
{
|
||||
bool selected;
|
||||
assert(node != NULL);
|
||||
|
||||
if ((node->flags & TREE_NODE_EXPANDED) == false) {
|
||||
@ -1165,6 +1168,8 @@ nserror treeview_node_contract(treeview *tree, treeview_node *node)
|
||||
return NSERROR_OK;
|
||||
}
|
||||
|
||||
selected = node->flags & TREE_NODE_SELECTED;
|
||||
|
||||
/* Contract children. */
|
||||
treeview_walk_internal(node, false, NULL,
|
||||
treeview_node_contract_cb, NULL);
|
||||
@ -1172,6 +1177,9 @@ nserror treeview_node_contract(treeview *tree, treeview_node *node)
|
||||
/* Contract node */
|
||||
treeview_node_contract_cb(node, NULL, false, false);
|
||||
|
||||
if (selected)
|
||||
node->flags |= TREE_NODE_SELECTED;
|
||||
|
||||
/* Inform front end of change in dimensions */
|
||||
tree->cw_t->update_size(tree->cw_h, -1, tree->root->height);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user