Skip to content
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

Fixes #2601 - Adds ability to filter TreeView branches/leaves #2599

Merged
merged 2 commits into from
May 10, 2023

Conversation

tznind
Copy link
Collaborator

@tznind tznind commented May 6, 2023

Fixes #2601 - Adds ability to filter TreeView branches/leaves (e.g. free text search).

I've created this targeting develop as it has quite a small footprint and its a really nice to have core feature I think.

It should be pretty easy to cherry pick to v2_develop

Because a tree is hierarchical its important to consider whether a filter matches the parent or child too. I went for greatest matching so:

  • If a branch matches then all sub branches/leaves show even if they don't match the filter
  • If a leaf/branch matches all its parents are automatically shown (to expose the matching child)

As with all things in TableView it is only the expanded nodes that get processed. If a node is not expanded its children are unknown (so not considered for matching). This is because of how the table builds itself as the user expands rather than loading everything up front (which can be impossible for some data structures - e.g. file system).

filter

Draft as now so I can write some tests

Pull Request checklist:

  • I've named my PR in the form of "Fixes #issue. Terse description."
  • My code follows the style guidelines of Terminal.Gui - if you use Visual Studio, hit CTRL-K-D to automatically reformat your files before committing.
  • My code follows the Terminal.Gui library design guidelines
  • I ran dotnet test before commit
  • I have made corresponding changes to the API documentation (using /// style comments)
  • My changes generate no new warnings
  • I have checked my code and corrected any poor grammar or misspellings
  • I conducted basic QA to assure all features are working

@tznind tznind marked this pull request as ready for review May 6, 2023 15:28
@tznind tznind changed the title Adds ITreefilter Fixes #2601 - Adds ITreefilter May 6, 2023
@tznind tznind changed the title Fixes #2601 - Adds ITreefilter Fixes #2601 - Adds ability to filter TreeView branches/leaves May 6, 2023
@tznind
Copy link
Collaborator Author

tznind commented May 7, 2023

Ok after a bit of trial and git horror I have squashed. to 9c11f61

I will open another PR to cherry pick into v2_develop

Test failure seems unrelated (virtual key stuff)

@tig tig merged commit 8f199cd into gui-cs:develop May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support filtering in TreeView
2 participants