Răsfoiți Sursa

Fixes #2554 FileDialog collection navigator now works on all fields (#2555)

* Fix FileDialog collection navigator only working on filename

* Improve collection navigator pattern matching
- Exclude Icon
- Works with .exe, .pdb etc
Thomas Nind 2 ani în urmă
părinte
comite
bd2564cf01
1 a modificat fișierele cu 11 adăugiri și 2 ștergeri
  1. 11 2
      Terminal.Gui/Views/FileDialog.cs

+ 11 - 2
Terminal.Gui/Views/FileDialog.cs

@@ -537,13 +537,18 @@ namespace Terminal.Gui {
 
 		private void UpdateCollectionNavigator ()
 		{
+			tableView.EnsureValidSelection ();
+			var col = tableView.SelectedColumn;
+			var style = tableView.Style.GetColumnStyleIfAny (tableView.Table.Columns [col]);
+
 
 			var collection = tableView
 				.Table
 				.Rows
 				.Cast<DataRow> ()
-				.Select ((o, idx) => RowToStats (idx))
-				.Select (s => s.FileSystemInfo.Name)
+				.Select ((o, idx) => col == 0 ? 
+					RowToStats(idx).FileSystemInfo.Name :
+					style.GetRepresentation (o [0])?.TrimStart('.'))
 				.ToArray ();
 
 			collectionNavigator = new CollectionNavigator (collection);
@@ -910,6 +915,10 @@ namespace Terminal.Gui {
 
 				this.pushingState = false;
 			}
+
+			if (obj.NewCol != obj.OldCol) {
+				UpdateCollectionNavigator ();
+			}
 		}
 
 		private bool TableView_KeyUp (KeyEvent keyEvent)