-
-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Tree Search Functionality with Highlighting and Filtering #229
Conversation
2321587
to
af15dde
Compare
Thanks for submitting! Since it's a big chunk of code, I need some time to review it fully. Got a crash during testing: with an active search, I switched to another tab and pressed enter. It's one of those cached Thinking about it, search state should probably be remembered per tab. I only skimmed through your code a little bit, and it doesn't look like it's the case, but would require changes to achieve that. Maybe |
Great catch! |
Yes this is a good chunk of code. And I expect much of it not to align with what you want. Please take your time for review(s). Will later find some time to address invalidation and add some FAIL-conds. You are thinking into an interesting direction with your proposal of caching multiple tabs. Edit: Now that I think about it, it'd not be necessary to include the TaskTree. We could pass the necessary information down into the For now tho, I will make this work without error before such major changes. |
47706e9 9a1641e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beware, nitpicks incoming 🤣
I've tested it, and it works really well - didn't find any other issues. If you are concerned about the selection box being confusing, we can try a custom StyleBox: a filled square built from the font color with the alpha set somewhere in [0.1,0.9] range - should work with any theme, I believe. Some additional suggestions:
|
This commit vastly improves performance by not updating the tree for search mask. From this commit onward, we are in very unstable territory. Relates to: limbonaut#229
Experimental, hence this is on a different branch. This commit vastly improves performance by not updating the tree for search mask changes. Relates to: limbonaut#229
* Improve TreeSearch performance. Experimental, hence this is on a different branch. This commit vastly improves performance by not updating the tree for search mask changes. Relates to: limbonaut#229 * Fix SearchTree overdraw after performance optimization * Manage Performance optimizations: TreeSearch no. 2 - Carefully manage callable_cache - Only clear filter when previously filtered - Reintroduce sorting for ordered_tree_items This commit addresses performance issues in TreeSearch and fixes a critical bug where ordered_tree_items was not being sorted. The bug was introduced during a merge with the main feature branch. * Use queue_redraw as much as possible for Tree updates. * Fix TreeSearch after performance considerations
55d47a3
to
b7af98e
Compare
As discussed. Squash incoming... |
14cfb14
to
93524dd
Compare
This commit introduces a comprehensive Tree Search feature, including: - Tree highlighting: Highlights items that match the search query. - Tree filtering: Filters items so only matches and descendants are shown. - Counting descendants: Shows the number of matching items within collapsed branches. - Jump to next match: on enter. - (Limbo-)Shortcut: Default CTRL-F. - Menu entry: Misc->Search Tree. - Remember separate SearchInfo for each tab. Key implementation details: - Optimized performance for large trees - Implemented recursive filtering for efficiency - Added UI elements including next/previous match buttons Development History: - Initial implementation of highlighting and filtering - Multiple rounds of performance optimization - Bug fixes and refactoring for correctness - UI enhancements and polish - Code cleanup and style improvements
It works really well even with drag and drop. The only major issue I noticed is that when I have a task named |
Yes. The current behavior: Match case when input contains capital letter. Might need adjustment: Not intuitive. @limbonaut also pointed this out. IMO, we can easily change that after this is merged.
|
From reading the code, I think the idea is that if you supply a lower-case string, the search assumes case-insensitive, and if you mix-in CAPS - it assumes case-sensitive. We are trying to establish if it's a bug or a feature. |
The search's placeholder text should probably include this as a hint. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good! I've added just a few suggestions. In testing, it works like a charm.
We can consider if the case-sensitive issue needs changing, but no need to block this PR until that decision is made.
Remove redundant comment Prune tab_search_context Fix restore tab on `_tab_closed` Add break statement Pass callable by reference in _draw_highlight_item Refactor _initialize_controls into constructor Remove redundant if (!line_edit_search)-check
MacOS task appears to be broken. Fixed on master. See: |
98da0db
to
8c557f8
Compare
Does a tooltip for the search box suffice for now? line_edit_search->set_tooltip_text("Match case if input contains capital letter."); |
Hmm, bummer. |
Looks like it's good to merge 👍 |
Great stuff! ❤️ Thanks for the contribution. |
Closes #192
Tested with GDExtension and Module.
Features:
Known issues:
(same as engine code)TreeSearch::_draw_highlight_item
: uses one magic numberTreeSearch::_find_matching_entries
et al (cc8f099)Searchbar spacing should be adjusted.(Already similar to Docs/Script search bar with 8c32395)Word highlight drawing might be too obstructive. Especially in filter mode.(Will be solved after this is merged)Wishlist (non-blockers)
search-maskSearchInfo
for each tab. (10c8f58)This pr includes a significant amount of new code (~500 lines). I would greatly appreciate any feedback, especially regarding the known issues listed above.
demo_filter_tree.webm