Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions Terminal.Gui/Views/TableView/TableView.Selection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 ();

Expand All @@ -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 ();

Expand Down
26 changes: 0 additions & 26 deletions Tests/UnitTestsParallelizable/Views/TableViewBaselineTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()
{
Expand All @@ -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 ()
{
Expand Down
16 changes: 15 additions & 1 deletion docfx/docs/tableview.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 |
Expand Down
Loading