Repository navigation
fix(shared): command output no longer prints the final byte of escape sequences with intermediates #30724
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
maria-rcks
merged 3 commits into
pingdotgg:main
from
geezoria:fix/command-output-escape-intermediates
Nov 6, 2026
+31
−4
Merged
fix(shared): command output no longer prints the final byte of escape sequences with intermediates #30724
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
3275f16
fix(shared): command output no longer prints the last byte of ESC seq…
geezoria1337 1717fdf
fix(shared): an ESC after escape intermediates starts the next sequence
geezoria1337 aed463b
fix(shared): a control after escape intermediates is not taken as the…
geezoria1337 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Preserve controls inside escape sequences.
A control character is not a final byte. For
before\u001b#\n8after, this consumes the newline and rendersbefore8after. Process the newline and continue scanning for the final byte instead. Add a split-chunk regression case. (vt100.net)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirmed, this was another case my change got wrong:
ESC # LF 8took the line feed as the final byte and lost the newline. Main kept it (a\n8b).Fixed in the latest commit. Only 0x30–0x7E can end the sequence. If anything else follows the intermediates, whether a control or a new ESC, the sequence now ends before that byte, so the byte is processed normally. This replaces the ESC-only special case from the previous commit with that general rule. The regression test covers
a ESC # LF 8 b→a\n8banda ESC # ESC [31m bat every split point. I also compared these with main's parser, plusESC ( % LFandESC #followed by a non-ASCII character, and every output is identical.I haven't implemented executing controls inside the sequence and then still consuming the final byte, so
ESC # LF 8is not treated as DECALN. Main doesn't do that either, and it would mean restructuring the parser rather than measuring the sequence length. I've kept this PR to "don't print stray final bytes" without changing any output for interrupted sequences.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Analysis chain
Script executed:
Length of output: 44396
@geezoriaPreserving the existing interrupted-sequence behavior is appropriate for this PR. My request to continue scanning after the control character went beyond the regression fix.I could not verify the latest change. The inspected checkout still has the ESC-only special case in
packages/shared/src/terminalOutput.ts. Its regression test covers interruption by ESC, but not LF.Please retry verification after the latest commit is available to the review checkout. The remaining check is the
0x30–0x7Efinal-byte guard and the LF regression at every split point. I did not run tests.Learnings used
If you found this review helpful, would you consider giving us a shout-out on X?
Thank you for using CodeRabbit!
You are interacting with an AI system.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Analysis chain
Script executed:
Length of output: 44396
@geezoriaPreserving the existing interrupted-sequence behavior is appropriate for this PR. My request to continue scanning after the control character went beyond the regression fix.I could not verify the latest change. The inspected checkout still has the ESC-only special case in
packages/shared/src/terminalOutput.ts. Its regression test covers interruption by ESC, but not LF.Please retry verification after the latest commit is available to the review checkout. The remaining check is the
0x30–0x7Efinal-byte guard and the LF regression at every split point. I did not run tests.Learnings used
If you found this review helpful, would you consider giving us a shout-out on X?
Thank you for using CodeRabbit!
You are interacting with an AI system.