mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-22 22:41:30 +03:00
Polish node deletion.
This commit is contained in:
parent
09f5b0e95f
commit
9a59103c6a
@ -1066,6 +1066,7 @@ static nserror treeview_delete_node_internal(treeview *tree, treeview_node *n,
|
||||
|
||||
/* Inform front end of change in dimensions */
|
||||
if (tree->root != NULL && p != NULL && p->flags & TREE_NODE_EXPANDED &&
|
||||
nd.h_reduction > 0 &&
|
||||
!(flags & TREE_OPTION_SUPPRESS_RESIZE)) {
|
||||
tree->cw_t->update_size(tree->cw_h, -1,
|
||||
tree->root->height);
|
||||
@ -1183,7 +1184,6 @@ nserror treeview_delete_node(treeview *tree, treeview_node *n,
|
||||
nserror err;
|
||||
struct rect r;
|
||||
treeview_node *p;
|
||||
int h;
|
||||
|
||||
assert(tree != NULL);
|
||||
assert(n != NULL);
|
||||
@ -1197,16 +1197,21 @@ nserror treeview_delete_node(treeview *tree, treeview_node *n,
|
||||
if (err != NSERROR_OK)
|
||||
return err;
|
||||
|
||||
h = tree->root->height;
|
||||
if (tree->flags & TREEVIEW_DEL_EMPTY_DIRS) {
|
||||
int h = tree->root->height;
|
||||
/* Delete any empty nodes */
|
||||
err = treeview_delete_empty_nodes(tree, false);
|
||||
if (err != NSERROR_OK)
|
||||
return err;
|
||||
}
|
||||
/* Inform front end of change in dimensions */
|
||||
if (tree->root->height != h && !(flags & TREE_OPTION_SUPPRESS_RESIZE)) {
|
||||
tree->cw_t->update_size(tree->cw_h, -1, tree->root->height);
|
||||
|
||||
/* Inform front end of change in dimensions */
|
||||
if (tree->root->height != h) {
|
||||
r.y0 = 0;
|
||||
if (!(flags & TREE_OPTION_SUPPRESS_RESIZE)) {
|
||||
tree->cw_t->update_size(tree->cw_h, -1,
|
||||
tree->root->height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Redraw */
|
||||
@ -2461,9 +2466,16 @@ bool treeview_keypress(treeview *tree, uint32_t key)
|
||||
redraw = treeview_delete_selection(tree, &r);
|
||||
|
||||
if (tree->flags & TREEVIEW_DEL_EMPTY_DIRS) {
|
||||
int h = tree->root->height;
|
||||
/* Delete any empty nodes */
|
||||
err = treeview_delete_empty_nodes(tree, true);
|
||||
r.y0 = 0;
|
||||
err = treeview_delete_empty_nodes(tree, false);
|
||||
|
||||
/* Inform front end of change in dimensions */
|
||||
if (tree->root->height != h) {
|
||||
r.y0 = 0;
|
||||
tree->cw_t->update_size(tree->cw_h, -1,
|
||||
tree->root->height);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case KEY_CR:
|
||||
|
@ -48,7 +48,7 @@ typedef enum {
|
||||
TREE_OPTION_NONE = (0), /* No flags set */
|
||||
TREE_OPTION_SUPPRESS_RESIZE = (1 << 0), /* Suppress callback */
|
||||
TREE_OPTION_SUPPRESS_REDRAW = (1 << 1) /* Suppress callback */
|
||||
} treeview_node_options_flags; /**< Node creation settings */
|
||||
} treeview_node_options_flags; /**< Node change handling options */
|
||||
|
||||
typedef enum {
|
||||
TREEVIEW_NO_FLAGS = (0), /**< No flags set */
|
||||
|
Loading…
Reference in New Issue
Block a user