From b1ecd216f203dfdfb579d64a72e263fa8fc09488 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Mon, 1 Jun 2026 20:24:51 -0700 Subject: [PATCH] fix(InputHandler): clear wrap after EL1 full-line erase CSI EL Ps=1 erases from the start of the row through the cursor. When the cursor is in the last column, that clears the entire row but did not clear isWrapped on the following line. eraseInDisplay Ps=1 already handled this case with ybase-aware indexing. Mirror that behavior in eraseInLine so soft-wrap chains stay consistent after erase-to-left at end of line. Co-authored-by: Cursor --- src/common/InputHandler.test.ts | 7 +++++++ src/common/InputHandler.ts | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/src/common/InputHandler.test.ts b/src/common/InputHandler.test.ts index 9eab8cfa2..db8f771a0 100644 --- a/src/common/InputHandler.test.ts +++ b/src/common/InputHandler.test.ts @@ -475,6 +475,13 @@ describe('InputHandler', () => { inputHandler.eraseInLine(Params.fromArray([1])); assert.equal(bufferService.buffer.lines.get(2)!.isWrapped, true); + // params[1] - full line erase at last column clears wrap on next line + await resetToBaseState(); + bufferService.buffer.y = 1; + bufferService.buffer.x = bufferService.cols - 1; + inputHandler.eraseInLine(Params.fromArray([1])); + assert.equal(bufferService.buffer.lines.get(2)!.isWrapped, false); + // params[2] - erase complete line await resetToBaseState(); bufferService.buffer.y = 2; diff --git a/src/common/InputHandler.ts b/src/common/InputHandler.ts index 9338d0d15..94a6401d3 100644 --- a/src/common/InputHandler.ts +++ b/src/common/InputHandler.ts @@ -1324,6 +1324,12 @@ export class InputHandler extends Disposable implements IInputHandler { break; case 1: this._eraseInBufferLine(this._activeBuffer.y, 0, this._activeBuffer.x + 1, false, respectProtect); + if (this._activeBuffer.x + 1 >= this._bufferService.cols) { + const nextLine = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y + 1); + if (nextLine) { + nextLine.isWrapped = false; + } + } break; case 2: this._eraseInBufferLine(this._activeBuffer.y, 0, this._bufferService.cols, true, respectProtect);