From 30c6a5c60d7467b40b8a03852a30e19e72edbacf Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 30 Apr 2026 19:46:01 +0000 Subject: [PATCH 1/2] Initial plan From e3337d56a812e53c5e41953b913d4791e614f988 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 30 Apr 2026 19:53:33 +0000 Subject: [PATCH 2/2] fix: make TableView Home End honor full row select Agent-Logs-Url: https://github.com/gui-cs/Terminal.Gui/sessions/b9cff572-1221-49be-8678-71b95183b84f Co-authored-by: tig <585482+tig@users.noreply.github.com> --- .../Views/TableView/TableView.Selection.cs | 10 +++++++ .../Views/TableViewBaselineTests.cs | 26 +++++++++++++++++++ docfx/docs/tableview.md | 2 +- 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/Terminal.Gui/Views/TableView/TableView.Selection.cs b/Terminal.Gui/Views/TableView/TableView.Selection.cs index 0298b0787b..6a994a1912 100644 --- a/Terminal.Gui/Views/TableView/TableView.Selection.cs +++ b/Terminal.Gui/Views/TableView/TableView.Selection.cs @@ -32,6 +32,11 @@ public bool MoveCursorToEndOfRow (bool extend, ICommandContext? ctx) return false; } + if (FullRowSelect) + { + return MoveCursorToEndOfTable (extend, ctx); + } + SetSelection (Table!.Columns - 1, _cursorRow, extend, ctx); Update (); @@ -48,6 +53,11 @@ 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 74828bbc04..89939bd96f 100644 --- a/Tests/UnitTestsParallelizable/Views/TableViewBaselineTests.cs +++ b/Tests/UnitTestsParallelizable/Views/TableViewBaselineTests.cs @@ -191,6 +191,19 @@ 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 () { @@ -202,6 +215,19 @@ 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 625ccc6ce7..d0b92f2f58 100644 --- a/docfx/docs/tableview.md +++ b/docfx/docs/tableview.md @@ -148,7 +148,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 | +| Home / End | Move to start/end of row. With `FullRowSelect`, move to first/last 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 |