Repository navigation
Conversation
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 #6165.
Problem
SerializeAddonrestores the cursor with a relative move computed asrealCursorCol - _lastCursorCol. When the serialized stream ends on a full row, thereplayed cursor sits in the pending-wrap sentinel column (
cursorX === cols), and_lastCursorColiscolsas well. A relativeCSI n Dissued from that state collapsesthe sentinel first and then moves, so the cursor lands one column short and all following
output shifts left.
Measured on
master: withcursorX === cols,CSI 1 Dlands on column 8, whileCSI 10 Glands on column 9.Minimal repro (also added as a unit test):
XY[9, 0]ABCDEFGHIX/Y[8, 0]ABCDEFGHXY/ (empty)Fix
When the tracked column is at or past
cols, the column is set withCSI <col+1> Ginstead of a relative move.
Why not clamp
_lastCursorColI first tried clamping the tracked column to
cols - 1. That is worse: it discards thesentinel entirely, so the restored terminal has no pending wrap and the next character
wraps to the following row instead of overwriting the last cell.
Verification
masterand passes with the fixnpm run test-unit -- addons/addon-serialize/out-esbuild/SerializeAddon.test.js→ 45 passingnpm run test-unit→ all greennpm run lint→Found 0 warnings and 0 errors.