Fix descendent counter in TreeSearch

This commit is contained in:
Alexander Montag 2024-09-29 16:48:57 +02:00
parent e68e0236e9
commit 6200f61162
No known key found for this signature in database
GPG Key ID: 07FE50B35A2B7524
2 changed files with 5 additions and 1 deletions

View File

@ -405,6 +405,7 @@ void TreeSearch::update_search(Tree *p_tree) {
// clear and redraw if search was active recently. // clear and redraw if search was active recently.
if (was_searched_recently) { if (was_searched_recently) {
_clear_filter(); _clear_filter();
number_matches.clear();
matching_entries.clear(); matching_entries.clear();
was_searched_recently = false; was_searched_recently = false;
p_tree->queue_redraw(); p_tree->queue_redraw();

View File

@ -53,10 +53,13 @@ private:
// For TaskTree: These are updated when the tree is updated through TaskTree::_create_tree. // For TaskTree: These are updated when the tree is updated through TaskTree::_create_tree.
Tree *tree_reference; Tree *tree_reference;
// linearized ordering of tree items.
Vector<TreeItem *> ordered_tree_items; Vector<TreeItem *> ordered_tree_items;
// entires that match the search mask.
Vector<TreeItem *> matching_entries; Vector<TreeItem *> matching_entries;
// number of descendant matches for each tree item.
HashMap<TreeItem *, int> number_matches; HashMap<TreeItem *, int> number_matches;
// custom draw-callbacks for each tree item.
HashMap<TreeItem *, Callable> callable_cache; HashMap<TreeItem *, Callable> callable_cache;
bool was_searched_recently = false; // Performance bool was_searched_recently = false; // Performance