From 9847dcaaccf4dd773b4187525848a6a51b940f97 Mon Sep 17 00:00:00 2001 From: meganrogge Date: Tue, 15 Feb 2022 11:38:04 -0600 Subject: [PATCH 1/4] 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 7e6fbd3a..0df992c8 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 8addf45a..b360641d 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 9259d46d..36b70b7f 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 { From f42e78d832dfc6190a06aba77f31299ed2a7a34f Mon Sep 17 00:00:00 2001 From: meganrogge Date: Tue, 15 Feb 2022 11:47:41 -0600 Subject: [PATCH 2/4] fix https://github.com/microsoft/vscode/issues/143076 --- src/browser/services/DecorationService.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/browser/services/DecorationService.ts b/src/browser/services/DecorationService.ts index 28785224..c4a00eee 100644 --- a/src/browser/services/DecorationService.ts +++ b/src/browser/services/DecorationService.ts @@ -111,18 +111,18 @@ export class Decoration extends Disposable implements IDecoration { } this._element = document.createElement('div'); this._element.classList.add('xterm-decoration'); - this._element.style.width = `${this.width * renderService.dimensions.scaledCellWidth}px`; - this._element.style.height = `${this.height * renderService.dimensions.scaledCellHeight}px`; - this._element.style.top = `${(this.marker.line - this._bufferService.buffers.active.ydisp) * renderService.dimensions.scaledCellHeight}px`; + this._element.style.width = `${this.width * renderService.dimensions.actualCellWidth}px`; + this._element.style.height = `${this.height * renderService.dimensions.actualCellHeight}px`; + this._element.style.top = `${(this.marker.line - this._bufferService.buffers.active.ydisp) * renderService.dimensions.actualCellHeight}px`; if (this.x && this.x > this._bufferService.cols) { // exceeded the container width, so hide this._element.style.display = 'none'; } if (this.anchor === 'right') { - this._element.style.right = this.x ? `${this.x * renderService.dimensions.scaledCellWidth}px` : ''; + this._element.style.right = this.x ? `${this.x * renderService.dimensions.actualCellWidth}px` : ''; } else { - this._element.style.left = this.x ? `${this.x * renderService.dimensions.scaledCellWidth}px` : ''; + this._element.style.left = this.x ? `${this.x * renderService.dimensions.actualCellWidth}px` : ''; } this.register({ dispose: () => { @@ -152,7 +152,7 @@ export class Decoration extends Disposable implements IDecoration { // outside of viewport this._element.style.display = 'none'; } else { - this._element.style.top = `${line * renderService.dimensions.scaledCellHeight}px`; + this._element.style.top = `${line * renderService.dimensions.actualCellHeight}px`; this._element.style.display = this._altBufferActive ? 'none' : 'block'; } } From 7134eaf20c86b55ea58898ad9c0cb1d38c829761 Mon Sep 17 00:00:00 2001 From: meganrogge Date: Tue, 15 Feb 2022 11:57:20 -0600 Subject: [PATCH 3/4] remove trailing space --- src/common/buffer/Buffer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/buffer/Buffer.ts b/src/common/buffer/Buffer.ts index b360641d..17831f39 100644 --- a/src/common/buffer/Buffer.ts +++ b/src/common/buffer/Buffer.ts @@ -595,7 +595,7 @@ export class Buffer implements IBuffer { for (const marker of this.markers) { marker.dispose(); } - } + } this._isClearing = false; } From 816f62cebc27f1a3c2e8797bcad5147260be5405 Mon Sep 17 00:00:00 2001 From: meganrogge Date: Tue, 15 Feb 2022 15:36:03 -0600 Subject: [PATCH 4/4] remove unnecessary prop --- src/browser/services/DecorationService.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/browser/services/DecorationService.ts b/src/browser/services/DecorationService.ts index c4a00eee..957a5de5 100644 --- a/src/browser/services/DecorationService.ts +++ b/src/browser/services/DecorationService.ts @@ -59,7 +59,6 @@ export class DecorationService extends Disposable implements IDecorationService export class Decoration extends Disposable implements IDecoration { private readonly _marker: IMarker; private _element: HTMLElement | undefined; - private _altBufferActive: boolean = false; public isDisposed: boolean = false; @@ -89,7 +88,6 @@ export class Decoration extends Disposable implements IDecoration { this.anchor = options.anchor || 'left'; this.width = options.width || 1; this.height = options.height || 1; - this.register(this._bufferService.buffers.onBufferActivate((event) => this._altBufferActive = event.activeBuffer === this._bufferService.buffers.alt)); } public render(renderService: IRenderService, shouldRecreate?: boolean): void { @@ -153,7 +151,7 @@ export class Decoration extends Disposable implements IDecoration { this._element.style.display = 'none'; } else { this._element.style.top = `${line * renderService.dimensions.actualCellHeight}px`; - this._element.style.display = this._altBufferActive ? 'none' : 'block'; + this._element.style.display = this._bufferService.buffer === this._bufferService.buffers.alt ? 'none' : 'block'; } } }