tagtree: Discard item history when selection changes in both directions

A changed selection only caused the item
history for deeper levels to be discarded
in tagtree_enter, when you were descending,
but not in tagtree_exit when you were ascending
the menu hierarchy again.

Change-Id: Ia40fa47980a05c2569e8af04e928b06130aa1f33
This commit is contained in:
Christian Soffke 2022-12-31 03:47:27 +01:00
parent 178560f495
commit 1773e56447

View file

@ -2035,12 +2035,16 @@ int tagtree_enter(struct tree_context* c, bool is_visible)
void tagtree_exit(struct tree_context* c, bool is_visible) void tagtree_exit(struct tree_context* c, bool is_visible)
{ {
if (is_visible) /* update selection history only for user-selected items */ if (is_visible) /* update selection history only for user-selected items */
{
if (c->selected_item != selected_item_history[c->dirlevel])
max_history_level = c->dirlevel; /* discard descending item history */
selected_item_history[c->dirlevel] = c->selected_item; selected_item_history[c->dirlevel] = c->selected_item;
}
c->dirfull = false; c->dirfull = false;
if (c->dirlevel > 0) if (c->dirlevel > 0)
c->dirlevel--; c->dirlevel--;
if (is_visible) if (is_visible)
c->selected_item=selected_item_history[c->dirlevel]; c->selected_item = selected_item_history[c->dirlevel];
c->currtable = table_history[c->dirlevel]; c->currtable = table_history[c->dirlevel];
c->currextra = extra_history[c->dirlevel]; c->currextra = extra_history[c->dirlevel];
} }