Skip to content

Skip the zero-cell moves in the forced wrap separator - #6237

Open
daviwil wants to merge 1 commit into
xtermjs:masterfrom
daviwil:fix-serialize-zero-cell-moves
Open

daviwil wants to merge 1 commit into
xtermjs:masterfrom
daviwil:fix-serialize-zero-cell-moves

Conversation

@daviwil

@daviwil daviwil commented Oct 15, 2026

Copy link
Copy Markdown

Fixes #6231

When _rowEnd forces a wrap after a row that ends in empty cells, it goes back up and erases the dashes it printed into them:

CSI A, CSI <content> C, CSI <empty> X, CSI <content> D, CSI B

with <content> as currentLine.length - this._nullCellCount. When the whole row is empty, that is 0, and CSI 0 C means a move of 1. The erase then started one cell late and left the first dash on screen.

The fix skips the two moves when there's no content to move past. Rows with content keep the same output.

For the repro in the issue, \x1b[A\x1b[0C\x1b[10X\x1b[0D\x1b[B becomes \x1b[A\x1b[10X\x1b[B, and the replay's first row is empty, as in the source.

The other computed moves in the serializer already skip a count of 0, so this was the only place that wrote one.

Testing:

  • New integration test handle empty row followed by wrapped row, using testNormalScreenEqual. It fails on master and passes with the fix.
  • addon-serialize integration suite on Chromium: 41 passed. I didn't run Firefox or WebKit locally.
  • npm run test-unit: 2403 passing. npm run lint-changes is clean.

This is independent of the fix for #6230 in the same function. The two branches merge cleanly in either order.

When the row before a forced wrap has no content, the moves around the
erase were written as `CSI 0 C` and `CSI 0 D`. A count of 0 means 1, so
the erase started one cell late and left the first dash on screen. Now
the moves are left out when there's nothing to move past.

Fixes xtermjs#6231
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.

SerializeAddon: the wrap separator writes CSI 0 C and CSI 0 D, which move one cell

1 participant