mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-28 17:23:09 +03:00
Update ancestor heights on node deletion.
This commit is contained in:
parent
0c3ac47b05
commit
31450767c9
@ -470,6 +470,7 @@ nserror treeview_delete_node(struct treeview *tree, struct treeview_node *n)
|
||||
{
|
||||
struct treeview_node_msg msg;
|
||||
msg.msg = TREE_MSG_NODE_DELETE;
|
||||
struct treeview_node *p;
|
||||
|
||||
/* Destroy children first */
|
||||
while (n->children != NULL) {
|
||||
@ -491,6 +492,13 @@ nserror treeview_delete_node(struct treeview *tree, struct treeview_node *n)
|
||||
n->sibling_next->sibling_prev = n->sibling_prev;
|
||||
}
|
||||
|
||||
/* Reduce ancestor heights */
|
||||
p = n->parent;
|
||||
while (p != NULL && p->flags & TREE_NODE_EXPANDED) {
|
||||
p->height -= n->height;
|
||||
p = p->parent;
|
||||
}
|
||||
|
||||
/* Handle any special treatment */
|
||||
switch (n->type) {
|
||||
case TREE_NODE_ENTRY:
|
||||
|
Loading…
Reference in New Issue
Block a user