Skip to content

Shift Spectre cursor positions to 1-based and clip WriteAt to the screen - #146

Merged
matt-edmondson merged 1 commit into
mainfrom
fix/spectre-cursor-origin-and-clipping
Sep 27, 2026
Merged

matt-edmondson merged 1 commit into
mainfrom
fix/spectre-cursor-origin-and-clipping

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Fixes #138
Fixes #139

Both bugs are on the same SetCursorPosition/WriteAt path in SpectreConsoleProvider, so the triage on each recommended fixing them together.

What changed

Tests

SpectreConsoleProviderTests captures the provider's ANSI output from a 10×5 Spectre console over a StringWriter. It covers the (0,0)/(0,1)/(1,0)/(W-1,H-1) cursor sequences, off-screen rows, text wholly left or right of the screen, a negative start X, and right-edge overflow.

  • With the fix: 187/187 pass.
  • With SpectreConsoleProvider.cs reverted: all 10 new test cases fail, and the 177 existing tests still pass.

🤖 Generated with Claude Code

https://claude.ai/code/session_015cCJCbaqmqLWvEB1Pep4Q9


Generated by Claude Code

…e screen [patch]

SetCursorPosition passed 0-based coordinates straight to Spectre, which emits
them as a 1-based ANSI CUP sequence, so rows 0 and 1 (and columns 0 and 1)
collapsed and the last row and column were unreachable. WriteAt also wrote text
whose position was off-screen at wherever the cursor had been left, and let text
overflow the right edge onto the next row. It now skips off-screen rows and
clips text to the visible columns.

Fixes #138
Fixes #139

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

Copy link
Copy Markdown

@matt-edmondson
matt-edmondson merged commit f4c5b1d into main Sep 27, 2026
12 checks passed
@matt-edmondson
matt-edmondson deleted the fix/spectre-cursor-origin-and-clipping branch September 27, 2026 06:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants