Skip to content

fix: hide and show the cursor on the injected console without moving it [patch] - #187

Merged
matt-edmondson merged 1 commit into
mainfrom
fix/153-cursor-visibility
Sep 30, 2026
Merged

matt-edmondson merged 1 commit into
mainfrom
fix/153-cursor-visibility

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Fixes #153

Before: SpectreConsoleProvider.SetCursorVisibility moved the cursor to a position read from System.Console, then set System.Console.CursorVisible. With a redirected, remote or test IAnsiConsole, that wrote a stray ESC[1;1H and the hide/show went to the real stdout.

After: it calls _console.Cursor.Show(visible), so ESC[?25l / ESC[?25h reaches the injected console and the cursor stays put.

Test: SetCursorVisibilityWritesToTheInjectedConsoleWithoutMovingTheCursor captures the provider's output over a StringWriter and asserts the output is exactly the DECTCEM sequence, with no CUP. It fails on main (both cases) and passes with the fix. Full TUI.Test suite: 226/226.

Not changed: GetCursorPosition() still reads System.Console. IAnsiConsole has no way to query the cursor position, so fixing that is a separate design question.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XMvgrK1uK13jn4qeVXxDi1


Generated by Claude Code

…it [patch]

SetCursorVisibility moved the cursor to a position read from System.Console
and toggled System.Console.CursorVisible, so a redirected or test console
got a stray cursor move and never saw the visibility change. It now calls
Cursor.Show on the injected IAnsiConsole.

Fixes #153

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XMvgrK1uK13jn4qeVXxDi1
@sonarqubecloud

Copy link
Copy Markdown

@matt-edmondson
matt-edmondson merged commit 1849267 into main Sep 30, 2026
14 checks passed
@matt-edmondson
matt-edmondson deleted the fix/153-cursor-visibility branch September 30, 2026 06:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SpectreConsoleProvider.SetCursorVisibility moves the cursor and toggles visibility on System.Console instead of the injected IAnsiConsole

2 participants