limboai icon indicating copy to clipboard operation
limboai copied to clipboard

WIP: Implement Tree Search Functionality with Highlighting and Filtering

Open monxa opened this issue 5 months ago • 5 comments

Closes #192

Tested with GDExtension and Module.

Features:

  • Tree highlighting: Highlights items that match the search query.
  • 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.

Known issues:

  • [x] Unnecessarily redundant signals (af15dde)
  • [x] ~~TreeSearch::_draw_highlight_item: uses one magic number~~ (same as engine code)
  • Performance
    • [x] TreeSearch::_find_matching_entries et al (cc8f099)
      • Can be solved by making it iterative instead of recursive, using linear push_back instead of insert and sorting once.
    • [x] Searches do a whole tree reconstruction for now: Noticeable lag. (https://github.com/monxa/limboai/pull/1)
  • [x] Editor scaling needs fixing (380f80c)
  • [x] ~~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)
  • [x] Jumping through entries currently inconsistent (8d29f16, 47706e9)
  • [x] Filtering unstable. (74cf985, 465757e)

Wishlist (non-blockers)

  1. Word highlight drawing might be too obstructive. Especially in filter mode.
    • [x] Remember separate ~~search-mask~~ SearchInfo for each tab. (10c8f58)
    • [x] Buttons for select next/previous entry (align with script/docs viewport). (ec6c4c3)
  2. Remember and restore tree collapse on jumping

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

monxa avatar Sep 25 '24 18:09 monxa