diff --git a/src/common/buffer/Buffer.ts b/src/common/buffer/Buffer.ts index f7dc97d3..a4cc4603 100644 --- a/src/common/buffer/Buffer.ts +++ b/src/common/buffer/Buffer.ts @@ -585,24 +585,31 @@ export class Buffer implements IBuffer { return x >= this._cols ? this._cols - 1 : x < 0 ? 0 : x; } - public clearMarkers(y?: number): void { + /** + * Clears markers on line @param y + */ + public clearMarkers(y: number): void { this._isClearing = true; - if (y !== undefined) { for (let i = 0; i < this.markers.length; i++) { if (this.markers[i].line === y) { this.markers[i].dispose(); this.markers.splice(i--, 1); } } - } else { - // buffer has been cleared - // don't dispose of markers on the current line (0) + this._isClearing = false; + } + + /** + * Clears markers on all lines except for + * those on @param excludeY + */ + public clearAllMarkers(excludeY: number): void { + this._isClearing = true; for (let i = 0; i < this.markers.length; i++) { - if (this.markers[i].line !== 0) { + if (this.markers[i].line !== excludeY) { this.markers[i].dispose(); this.markers.splice(i--, 1); } - } } this._isClearing = false; } diff --git a/src/common/buffer/Types.d.ts b/src/common/buffer/Types.d.ts index 36b70b7f..f26b4b26 100644 --- a/src/common/buffer/Types.d.ts +++ b/src/common/buffer/Types.d.ts @@ -45,7 +45,8 @@ export interface IBuffer { getNullCell(attr?: IAttributeData): ICellData; getWhitespaceCell(attr?: IAttributeData): ICellData; addMarker(y: number): IMarker; - clearMarkers(y?: number): void; + clearMarkers(y: number): void; + clearAllMarkers(excludeY: number): void; } export interface IBufferSet extends IDisposable {