Fixes #4027. Add collection search matcher (#4029)

* Add collection search matcher

* Fix naming

* fix naming

* Move FileDialogCollectionNavigator to its own file (no longer private class)
Add class diagram for collectionNavigation

* Add ICollectionNavigator interface

* Move to separate file IListCollectionNavigator

* Update class diagram

* update class diagram

* Add tests for overriding ICollectionNavigatorMatcher

* xmldoc and nullability warning fixes

* Code Cleanup

* Make requested changes to naming and terminology

* Move to seperate namespace

* Update class diagram and change TreeView to reference the interface not concrete class

* Switch to implicit new

* highlight that this class also works with tree view

* Apply tig patch to ensure keybindings get priority over navigator

See: https://github.com/gui-cs/Terminal.Gui/issues/4027#issuecomment-2810020893

* Apply 'keybinding has priority' fix to TreeView too

* Apply 'keybindngs priority over navigation' fix to TableView

* Remove entire branch for selectively returning false now that it is default when there is a keybinding collision

* Make classes internal and remove 'custom' navigator that was configured in UICatlaogToplevel

* Change logging in collection navigator from Trace to Debug

* Switch to NewKeyDownEvent and directly setting HasFocus

* Remove application top dependency

* Remove references to application

* Remove Application

* Move new tests to parallel

---------

Co-authored-by: Tig <tig@users.noreply.github.com>
This commit is contained in:
Thomas Nind
2025-04-28 13:39:11 +01:00
committed by Tig
parent 7fe6fd9453
commit 0a23df75da
21 changed files with 577 additions and 203 deletions

View File

@@ -58,7 +58,7 @@ public class CollectionNavigatorTester : Scenario
"$200.00",
"$210.99",
"$$",
"appricot",
"apricot",
"arm",
"丗丙业丞",
"丗丙丛",

View File

@@ -380,11 +380,6 @@ public class UICatalogTop : Toplevel
public static ObservableCollection<Scenario>? CachedScenarios { get; set; }
// UI Catalog uses TableView for the scenario list instead of a ListView to demonstrate how
// TableView works. There's no real reason not to use ListView. Because we use TableView, and TableView
// doesn't (currently) have CollectionNavigator support built in, we implement it here, within the app.
private readonly CollectionNavigator _scenarioCollectionNav = new ();
// If set, holds the scenario the user selected to run
public static Scenario? CachedSelectedScenario { get; set; }
@@ -561,16 +556,6 @@ public class UICatalogTop : Toplevel
}
);
// Create a collection of just the scenario names (the 1st column in our TableView)
// for CollectionNavigator.
List<object> firstColumnList = [];
for (var i = 0; i < _scenarioList.Table.Rows; i++)
{
firstColumnList.Add (_scenarioList.Table [i, 0]);
}
_scenarioCollectionNav.Collection = firstColumnList;
}
#endregion Category List