From 1773e56447785931968d46002b73307c1fb3a35a Mon Sep 17 00:00:00 2001 From: Christian Soffke Date: Sat, 31 Dec 2022 03:47:27 +0100 Subject: [PATCH] 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 --- apps/tagtree.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/tagtree.c b/apps/tagtree.c index 7887ee1c36..03af5fc83a 100644 --- a/apps/tagtree.c +++ b/apps/tagtree.c @@ -2035,12 +2035,16 @@ int tagtree_enter(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 (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; + } c->dirfull = false; if (c->dirlevel > 0) c->dirlevel--; 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->currextra = extra_history[c->dirlevel]; }