From 9847dcaaccf4dd773b4187525848a6a51b940f97 Mon Sep 17 00:00:00 2001 From: meganrogge Date: Tue, 15 Feb 2022 11:38:04 -0600 Subject: [PATCH] fix #3641 --- src/common/InputHandler.ts | 3 ++- src/common/buffer/Buffer.ts | 15 ++++++++++----- src/common/buffer/Types.d.ts | 2 +- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/common/InputHandler.ts b/src/common/InputHandler.ts index 7e6fbd3ae..0df992c8a 100644 --- a/src/common/InputHandler.ts +++ b/src/common/InputHandler.ts @@ -1218,6 +1218,7 @@ export class InputHandler extends Disposable implements IInputHandler { this._activeBuffer.getNullCell(this._eraseAttrData()), this._eraseAttrData() ); + this._bufferService.buffer.clearMarkers(y); if (clearWrap) { line.isWrapped = false; } @@ -1232,6 +1233,7 @@ export class InputHandler extends Disposable implements IInputHandler { const line = this._activeBuffer.lines.get(this._activeBuffer.ybase + y)!; line.fill(this._activeBuffer.getNullCell(this._eraseAttrData())); line.isWrapped = false; + this._bufferService.buffer.clearMarkers(y); } /** @@ -1292,7 +1294,6 @@ export class InputHandler extends Disposable implements IInputHandler { this._resetBufferLine(j); } this._dirtyRowService.markDirty(0); - this._bufferService.buffer.clearMarkers(); break; case 3: // Clear scrollback (everything not in viewport) diff --git a/src/common/buffer/Buffer.ts b/src/common/buffer/Buffer.ts index 8addf45ad..b360641d9 100644 --- a/src/common/buffer/Buffer.ts +++ b/src/common/buffer/Buffer.ts @@ -585,12 +585,17 @@ export class Buffer implements IBuffer { return x >= this._cols ? this._cols - 1 : x < 0 ? 0 : x; } - public clearMarkers(): void { + public clearMarkers(y?: number): void { this._isClearing = true; - for (const marker of this.markers) { - marker.dispose(); - } - this.markers = []; + if (y) { + for (const marker of this.markers.filter(m => m.line === y)) { + marker.dispose(); + } + } else { + for (const marker of this.markers) { + marker.dispose(); + } + } this._isClearing = false; } diff --git a/src/common/buffer/Types.d.ts b/src/common/buffer/Types.d.ts index 9259d46d4..36b70b7f3 100644 --- a/src/common/buffer/Types.d.ts +++ b/src/common/buffer/Types.d.ts @@ -45,7 +45,7 @@ export interface IBuffer { getNullCell(attr?: IAttributeData): ICellData; getWhitespaceCell(attr?: IAttributeData): ICellData; addMarker(y: number): IMarker; - clearMarkers(): void; + clearMarkers(y?: number): void; } export interface IBufferSet extends IDisposable {