Skip to content

Don't move up zero steps#2103

Closed
merklegroot wants to merge 3 commits into
spectreconsole:mainfrom
merklegroot:main
Closed

Don't move up zero steps#2103
merklegroot wants to merge 3 commits into
spectreconsole:mainfrom
merklegroot:main

Conversation

@merklegroot

Copy link
Copy Markdown
Contributor

Fixes #2076

Checklist

  • 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

Changes

When AnsiWriter.CursorUp(0) is called, I changed it to treat that as a no-op.
Different ANSI terminals are inconsistent about handle \x1b[0A (move up 0 lines)
https://unix.stackexchange.com/questions/559308/what-ansi-escape-0x1b0a-and-other-0-value-codes-should-do
(Most treat the zero as meaning move up the default number of lines and one line is the default.)

This resolves the Live display bug reported in #2076.

Tested on .NET 10.0 — relevant Live tests pass.

AI Disclosure

I used Cursor and Grok for assistance.

@merklegroot merklegroot marked this pull request as draft April 26, 2026 20:28
@merklegroot

Copy link
Copy Markdown
Contributor Author

Expanded the change to add the same guard clauses for the other cursor movement methods.
They all have the same issue -- ANSI normally interprets move 0 steps as move default steps where 1 is the default.

@patriksvensson

Copy link
Copy Markdown
Contributor

Looks good to me. Move this out of draft and I'll make sure it gets merged

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
@patriksvensson

Copy link
Copy Markdown
Contributor

@merklegroot Any specific reason you closed the PR?

@merklegroot

Copy link
Copy Markdown
Contributor Author

@merklegroot Any specific reason you closed the PR?

Couldn't get it to pick up the updates in the fork, so I remade it.
This PR has the changes.
#2104

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