fix: hide and show the cursor on the injected console without moving it [patch] - #187
Merged
Merged
Conversation
…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
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes #153
Before:
SpectreConsoleProvider.SetCursorVisibilitymoved the cursor to a position read fromSystem.Console, then setSystem.Console.CursorVisible. With a redirected, remote or testIAnsiConsole, that wrote a strayESC[1;1Hand the hide/show went to the real stdout.After: it calls
_console.Cursor.Show(visible), soESC[?25l/ESC[?25hreaches the injected console and the cursor stays put.Test:
SetCursorVisibilityWritesToTheInjectedConsoleWithoutMovingTheCursorcaptures the provider's output over aStringWriterand asserts the output is exactly the DECTCEM sequence, with no CUP. It fails onmain(both cases) and passes with the fix. FullTUI.Testsuite: 226/226.Not changed:
GetCursorPosition()still readsSystem.Console.IAnsiConsolehas 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