diff --git a/Terminal.Gui/Views/TableView/TableView.Selection.cs b/Terminal.Gui/Views/TableView/TableView.Selection.cs index 6a994a1912..0298b0787b 100644 --- a/Terminal.Gui/Views/TableView/TableView.Selection.cs +++ b/Terminal.Gui/Views/TableView/TableView.Selection.cs @@ -32,11 +32,6 @@ public bool MoveCursorToEndOfRow (bool extend, ICommandContext? ctx) return false; } - if (FullRowSelect) - { - return MoveCursorToEndOfTable (extend, ctx); - } - SetSelection (Table!.Columns - 1, _cursorRow, extend, ctx); Update (); @@ -53,11 +48,6 @@ public bool MoveCursorToStartOfRow (bool extend, ICommandContext? ctx) return false; } - if (FullRowSelect) - { - return MoveCursorToStartOfTable (extend, ctx); - } - SetSelection (0, _cursorRow, extend, ctx); Update (); diff --git a/Tests/UnitTestsParallelizable/Views/TableViewBaselineTests.cs b/Tests/UnitTestsParallelizable/Views/TableViewBaselineTests.cs index 89939bd96f..74828bbc04 100644 --- a/Tests/UnitTestsParallelizable/Views/TableViewBaselineTests.cs +++ b/Tests/UnitTestsParallelizable/Views/TableViewBaselineTests.cs @@ -191,19 +191,6 @@ public void Home_Key_MovesToStartOfRow () Assert.Equal (0, tv.Value!.Cursor.Y); // row unchanged } - [Fact] - public void Home_Key_FullRowSelect_MovesToFirstRow () - { - // Copilot - TableView tv = CreateTableView (5, 10); - tv.FullRowSelect = true; - tv.SetSelection (3, 5, false); - - tv.NewKeyDownEvent (Key.Home); - Assert.Equal (3, tv.Value!.Cursor.X); - Assert.Equal (0, tv.Value!.Cursor.Y); - } - [Fact] public void End_Key_MovesToEndOfRow () { @@ -215,19 +202,6 @@ public void End_Key_MovesToEndOfRow () Assert.Equal (0, tv.Value!.Cursor.Y); // row unchanged } - [Fact] - public void End_Key_FullRowSelect_MovesToLastRow () - { - // Copilot - TableView tv = CreateTableView (5, 10); - tv.FullRowSelect = true; - tv.SetSelection (1, 5, false); - - tv.NewKeyDownEvent (Key.End); - Assert.Equal (1, tv.Value!.Cursor.X); - Assert.Equal (9, tv.Value!.Cursor.Y); - } - [Fact] public void MoveCursorToStartOfTable_MovesToOrigin () { diff --git a/docfx/docs/tableview.md b/docfx/docs/tableview.md index d0b92f2f58..60842f27b0 100644 --- a/docfx/docs/tableview.md +++ b/docfx/docs/tableview.md @@ -124,6 +124,20 @@ Extended regions (`IsExtended = true`) persist through keyboard navigation. Non- When `FullRowSelect` is `true`, entire rows are selected instead of individual cells. All cells in the cursor's row are reported as selected by `GetAllSelectedCells ()` and `IsSelected ()`. +> **Tip — Home/End with FullRowSelect:** By default, `Home` and `End` navigate to the +> start/end of the current *row* (i.e. first/last column). To make `Home`/`End` jump to +> the first/last *row* instead (which is often more useful in full-row mode), rebind them +> to `Command.Start` and `Command.End`: +> +> ```csharp +> tableView.KeyBindings.Remove (Key.Home); +> tableView.KeyBindings.Add (Key.Home, Command.Start); +> tableView.KeyBindings.Remove (Key.End); +> tableView.KeyBindings.Add (Key.End, Command.End); +> ``` +> +> This is the pattern used by `UICatalogRunnable` for its scenario list. + ### Reading the Selection ```csharp @@ -148,7 +162,7 @@ bool sel = tv.IsSelected (col, row); | Arrow keys | Move cursor one cell | | Shift+Arrow | Extend selection | | PageUp / PageDown | Move one page | -| Home / End | Move to start/end of row. With `FullRowSelect`, move to first/last row | +| Home / End | Move to start/end of row | | Ctrl+Home / Ctrl+End | Move to first/last row | | Shift+Home/End/Ctrl+Home/Ctrl+End | Extend selection to row/table boundary | | Ctrl+A | Select all |