Skip to content

Don't emit ANSI sequence for 0 movement#2104

Merged
patriksvensson merged 1 commit into
spectreconsole:mainfrom
merklegroot:ansi-up-zero-fix
Apr 28, 2026
Merged

Don't emit ANSI sequence for 0 movement#2104
patriksvensson merged 1 commit into
spectreconsole:mainfrom
merklegroot:ansi-up-zero-fix

Conversation

@merklegroot

@merklegroot merklegroot commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

Fixes #2076

  • I have read the Contribution Guidelines
  • I have checked that there isn't already another pull request that solves the above issue
  • All newly added code is adequately covered by tests
  • All existing tests are still running without errors

AI Disclosure

I used Cursor and Grok to assist

Changes

Treat moving the cursor in ANSI by 0 as a no-op.
ANSI terminals handle this inconsistently.
Most of them default to treating a 0 movement as a default value, and the default is 1.
https://unix.stackexchange.com/questions/559308/what-ansi-escape-0x1b0a-and-other-0-value-codes-should-do


Please upvote 👍 this pull request if you are interested in it.

Prevents terminal inconsistencies with \e[0A \e[0B \e[0C \e[0D etc.
Applies the same guard to CursorUp/Down/Forward/Backward/NextLine/PreviousLine.
Fixes spectreconsole#2076
@merklegroot merklegroot marked this pull request as ready for review April 27, 2026 00:07
@merklegroot merklegroot mentioned this pull request Apr 27, 2026
4 tasks
@patriksvensson patriksvensson merged commit 2d51cb2 into spectreconsole:main Apr 28, 2026
4 checks passed
@merklegroot merklegroot deleted the ansi-up-zero-fix branch April 28, 2026 16:45
This was referenced Jun 11, 2026
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.

Bug in AnsiConsole.Live

2 participants