From 79536a9561b4ebd8935047a8110f945c013e9846 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 17 May 2026 07:45:15 +0000 Subject: [PATCH 1/2] Initial plan From 0f454dcbcbe225dbb55c65e3171c5ecf0f78518f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 17 May 2026 07:52:27 +0000 Subject: [PATCH 2/2] Preserve editor cursor style Agent-Logs-Url: https://github.com/gui-cs/Editor/sessions/2f30ddfc-b986-45d4-9820-47412795cdd3 Co-authored-by: tig <585482+tig@users.noreply.github.com> --- src/Terminal.Gui.Editor/Editor.Drawing.cs | 6 +++++- .../EditorRenderingTests.cs | 13 +++++++++++++ .../EditorTests.cs | 2 +- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/Terminal.Gui.Editor/Editor.Drawing.cs b/src/Terminal.Gui.Editor/Editor.Drawing.cs index e3f82e9..caa7172 100644 --- a/src/Terminal.Gui.Editor/Editor.Drawing.cs +++ b/src/Terminal.Gui.Editor/Editor.Drawing.cs @@ -362,6 +362,10 @@ private void UpdateCursor () } Point screen = ViewportToScreen (new Point (col, row)); - Cursor = new Cursor { Position = screen, Style = CursorStyle.BlinkingBar }; + Cursor = Cursor with + { + Position = screen, + Style = Cursor.Style == CursorStyle.Hidden ? CursorStyle.Default : Cursor.Style + }; } } diff --git a/tests/Terminal.Gui.Editor.IntegrationTests/EditorRenderingTests.cs b/tests/Terminal.Gui.Editor.IntegrationTests/EditorRenderingTests.cs index 086a452..c26d94c 100644 --- a/tests/Terminal.Gui.Editor.IntegrationTests/EditorRenderingTests.cs +++ b/tests/Terminal.Gui.Editor.IntegrationTests/EditorRenderingTests.cs @@ -330,6 +330,19 @@ public async Task Cursor_Position_After_Tab_Uses_Expanded_Tab_Columns () Assert.Equal (new Point (4, 0), fx.Top.Editor.Cursor.Position); } + [Fact] + public async Task Cursor_Style_Is_Preserved_When_Position_Updates () + { + await using AppFixture fx = new (() => new EditorTestHost ("abc")); + fx.Top.Editor.SetFocus (); + fx.Top.Editor.Cursor = new Cursor { Style = CursorStyle.SteadyUnderline }; + fx.Top.Editor.CaretOffset = 2; + fx.Render (); + + Assert.Equal (new Point (2, 0), fx.Top.Editor.Cursor.Position); + Assert.Equal (CursorStyle.SteadyUnderline, fx.Top.Editor.Cursor.Style); + } + [Fact] public async Task Highlighted_Tokens_Follow_The_Active_Scheme () { diff --git a/tests/Terminal.Gui.Editor.IntegrationTests/EditorTests.cs b/tests/Terminal.Gui.Editor.IntegrationTests/EditorTests.cs index f107037..233a054 100644 --- a/tests/Terminal.Gui.Editor.IntegrationTests/EditorTests.cs +++ b/tests/Terminal.Gui.Editor.IntegrationTests/EditorTests.cs @@ -531,6 +531,6 @@ public async Task Primary_Caret_Is_Visible_After_Exiting_MultiCaret () // The primary caret is the terminal cursor. After dismissing the block it must still be // drawn (visible, not the hidden default cursor) and positioned on the primary offset. - Assert.Equal (CursorStyle.BlinkingBar, fx.Top.Editor.Cursor.Style); + Assert.True (fx.Top.Editor.Cursor.IsVisible); } }