From 06357b1184e1ae9e7a66c79f4ea542697be76342 Mon Sep 17 00:00:00 2001 From: meganrogge Date: Fri, 11 Feb 2022 14:08:46 -0600 Subject: [PATCH 01/18] get rid of some unnecessary code --- 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 f29ec7ea..9dc4c4ac 100644 --- a/src/browser/services/DecorationService.ts +++ b/src/browser/services/DecorationService.ts @@ -17,7 +17,6 @@ export class DecorationService extends Disposable implements IDecorationService private _renderService: IRenderService | undefined; constructor( - @IBufferService private readonly _bufferService: IBufferService, @IInstantiationService private readonly _instantiationService: IInstantiationService) { super(); } @@ -28,7 +27,6 @@ export class DecorationService extends Disposable implements IDecorationService this._container = document.createElement('div'); this._container.classList.add('xterm-decoration-container'); screenElement.appendChild(this._container); - this.refresh(); this.register(this._renderService.onRenderedBufferChange(() => this.refresh())); this.register(this._renderService.onDimensionsChange(() => this.refresh(true))); } @@ -44,7 +42,7 @@ export class DecorationService extends Disposable implements IDecorationService } public refresh(recreate?: boolean): void { - if (!this._bufferService || !this._renderService) { + if (!this._renderService) { return; } for (const decoration of this._decorations) { From f160436df8e4954a13319411ba389f99f60153e8 Mon Sep 17 00:00:00 2001 From: meganrogge Date: Fri, 11 Feb 2022 14:54:01 -0600 Subject: [PATCH 02/18] dispose of decoration on dispose of marker --- src/browser/services/DecorationService.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/browser/services/DecorationService.ts b/src/browser/services/DecorationService.ts index 9dc4c4ac..df21d076 100644 --- a/src/browser/services/DecorationService.ts +++ b/src/browser/services/DecorationService.ts @@ -88,6 +88,7 @@ export class Decoration extends Disposable implements IDecoration { super(); this.x = options.x ?? 0; this._marker = options.marker; + this._marker.onDispose(() => this.dispose()); this.anchor = options.anchor || 'left'; this.width = options.width || 1; this.height = options.height || 1; From e44659e8bd3ef803b05571df141008db88257569 Mon Sep 17 00:00:00 2001 From: meganrogge Date: Fri, 11 Feb 2022 14:56:56 -0600 Subject: [PATCH 03/18] remove unused ID - can just use marker's --- src/browser/services/DecorationService.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/browser/services/DecorationService.ts b/src/browser/services/DecorationService.ts index df21d076..28f18a78 100644 --- a/src/browser/services/DecorationService.ts +++ b/src/browser/services/DecorationService.ts @@ -54,16 +54,14 @@ export class DecorationService extends Disposable implements IDecorationService for (const decoration of this._decorations) { decoration.dispose(); } - if (this._container) { - this._screenElement?.removeChild(this._container); + if (this._screenElement && this._container) { + this._screenElement.removeChild(this._container); } } } export class Decoration extends Disposable implements IDecoration { - private static _nextId = 1; private readonly _marker: IMarker; private _element: HTMLElement | undefined; - private readonly _id: number = Decoration._nextId++; public isDisposed: boolean = false; public get element(): HTMLElement | undefined { return this._element; } From d8573e38a8570c047a329eaf90a8f7e90b92a2f3 Mon Sep 17 00:00:00 2001 From: meganrogge Date: Fri, 11 Feb 2022 15:01:07 -0600 Subject: [PATCH 04/18] cleanup dispose --- src/browser/services/DecorationService.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/browser/services/DecorationService.ts b/src/browser/services/DecorationService.ts index 28f18a78..c9875610 100644 --- a/src/browser/services/DecorationService.ts +++ b/src/browser/services/DecorationService.ts @@ -126,9 +126,13 @@ export class Decoration extends Disposable implements IDecoration { if (this.isDisposed) { return; } - this._container.removeChild(this._element!); + if (!this.marker.isDisposed) { + this.marker.dispose(); + } + if (this._element) { + this._container.removeChild(this._element); + } this.isDisposed = true; - this._marker.dispose(); // Emit before super.dispose such that dispose listeners get a change to react this._onDispose.fire(); super.dispose(); From de3a09e05f97d8b37e80b2af8d1cdba0e31e9dfe Mon Sep 17 00:00:00 2001 From: meganrogge Date: Fri, 11 Feb 2022 15:09:40 -0600 Subject: [PATCH 05/18] fix #3633 --- src/common/InputHandler.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/common/InputHandler.ts b/src/common/InputHandler.ts index 88634048..7e6fbd3a 100644 --- a/src/common/InputHandler.ts +++ b/src/common/InputHandler.ts @@ -1292,6 +1292,7 @@ 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) From 3f525fb960cca18b7c78d9744c7c3d1c1d68cedf Mon Sep 17 00:00:00 2001 From: meganrogge Date: Fri, 11 Feb 2022 15:40:44 -0600 Subject: [PATCH 06/18] fix #3636 --- src/browser/services/DecorationService.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/browser/services/DecorationService.ts b/src/browser/services/DecorationService.ts index c9875610..a775be3f 100644 --- a/src/browser/services/DecorationService.ts +++ b/src/browser/services/DecorationService.ts @@ -15,9 +15,11 @@ export class DecorationService extends Disposable implements IDecorationService private _container: HTMLElement | undefined; private _screenElement: HTMLElement | undefined; private _renderService: IRenderService | undefined; + private _altBufferActive: boolean = false; constructor( - @IInstantiationService private readonly _instantiationService: IInstantiationService) { + @IInstantiationService private readonly _instantiationService: IInstantiationService, + @IBufferService private readonly _bufferService: IBufferService) { super(); } @@ -29,6 +31,7 @@ export class DecorationService extends Disposable implements IDecorationService screenElement.appendChild(this._container); this.register(this._renderService.onRenderedBufferChange(() => this.refresh())); this.register(this._renderService.onDimensionsChange(() => this.refresh(true))); + this.register(this._bufferService.buffers.onBufferActivate((event) => this._altBufferActive = event.activeBuffer === this._bufferService.buffers.alt)); } public registerDecoration(decorationOptions: IDecorationOptions): IDecoration | undefined { @@ -46,7 +49,7 @@ export class DecorationService extends Disposable implements IDecorationService return; } for (const decoration of this._decorations) { - decoration.render(this._renderService, recreate); + decoration.render(this._renderService, recreate, this._altBufferActive); } } @@ -92,14 +95,14 @@ export class Decoration extends Disposable implements IDecoration { this.height = options.height || 1; } - public render(renderService: IRenderService, recreate?: boolean): void { + public render(renderService: IRenderService, recreate?: boolean, altBufferActive?: boolean): void { if (!this._element || recreate) { this._createElement(renderService, recreate); } if (this._container && this._element && !this._container.contains(this._element)) { this._container.append(this._element); } - this._refreshStyle(renderService); + this._refreshStyle(renderService, altBufferActive); this._onRender.fire(this._element!); } @@ -140,14 +143,14 @@ export class Decoration extends Disposable implements IDecoration { }); } - private _refreshStyle(renderService: IRenderService): void { + private _refreshStyle(renderService: IRenderService, altBufferActive?: boolean): void { const line = this.marker.line - this._bufferService.buffers.active.ydisp; if (line < 0 || line > this._bufferService.rows) { // outside of viewport this._element!.style.display = 'none'; } else { this._element!.style.top = `${line * renderService.dimensions.scaledCellHeight}px`; - this._element!.style.display = 'block'; + this._element!.style.display = altBufferActive ? 'none' : 'block'; } } } From 7d357b941f9ac3342545b430d16d8ea9a4093f75 Mon Sep 17 00:00:00 2001 From: meganrogge Date: Fri, 11 Feb 2022 16:48:40 -0600 Subject: [PATCH 07/18] check if container has child before removing it --- src/browser/services/DecorationService.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/browser/services/DecorationService.ts b/src/browser/services/DecorationService.ts index a775be3f..24ceebcc 100644 --- a/src/browser/services/DecorationService.ts +++ b/src/browser/services/DecorationService.ts @@ -57,7 +57,7 @@ export class DecorationService extends Disposable implements IDecorationService for (const decoration of this._decorations) { decoration.dispose(); } - if (this._screenElement && this._container) { + if (this._screenElement && this._container && this._screenElement.contains(this._container)) { this._screenElement.removeChild(this._container); } } From 40e6dba43c4686d32c042922e30db720eddf6cb0 Mon Sep 17 00:00:00 2001 From: meganrogge Date: Fri, 11 Feb 2022 17:00:24 -0600 Subject: [PATCH 08/18] cleaner --- src/browser/services/DecorationService.ts | 31 +++++++++++++---------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/browser/services/DecorationService.ts b/src/browser/services/DecorationService.ts index 24ceebcc..d2096159 100644 --- a/src/browser/services/DecorationService.ts +++ b/src/browser/services/DecorationService.ts @@ -15,7 +15,6 @@ export class DecorationService extends Disposable implements IDecorationService private _container: HTMLElement | undefined; private _screenElement: HTMLElement | undefined; private _renderService: IRenderService | undefined; - private _altBufferActive: boolean = false; constructor( @IInstantiationService private readonly _instantiationService: IInstantiationService, @@ -31,7 +30,6 @@ export class DecorationService extends Disposable implements IDecorationService screenElement.appendChild(this._container); this.register(this._renderService.onRenderedBufferChange(() => this.refresh())); this.register(this._renderService.onDimensionsChange(() => this.refresh(true))); - this.register(this._bufferService.buffers.onBufferActivate((event) => this._altBufferActive = event.activeBuffer === this._bufferService.buffers.alt)); } public registerDecoration(decorationOptions: IDecorationOptions): IDecoration | undefined { @@ -44,12 +42,12 @@ export class DecorationService extends Disposable implements IDecorationService return decoration; } - public refresh(recreate?: boolean): void { + public refresh(shouldRecreate?: boolean): void { if (!this._renderService) { return; } for (const decoration of this._decorations) { - decoration.render(this._renderService, recreate, this._altBufferActive); + decoration.render(this._renderService, shouldRecreate); } } @@ -65,6 +63,8 @@ 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; public get element(): HTMLElement | undefined { return this._element; } @@ -93,21 +93,24 @@ 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, recreate?: boolean, altBufferActive?: boolean): void { - if (!this._element || recreate) { - this._createElement(renderService, recreate); + public render(renderService: IRenderService, shouldRecreate?: boolean): void { + if (!this._element || shouldRecreate) { + this._createElement(renderService, shouldRecreate); } if (this._container && this._element && !this._container.contains(this._element)) { this._container.append(this._element); } - this._refreshStyle(renderService, altBufferActive); - this._onRender.fire(this._element!); + this._refreshStyle(renderService); + if (this._element) { + this._onRender.fire(this._element); + } } - private _createElement(renderService: IRenderService, recreate?: boolean): void { - if (recreate && this._element) { + private _createElement(renderService: IRenderService, shouldRecreate?: boolean): void { + if (shouldRecreate && this._element) { this._container.removeChild(this._element); } this._element = document.createElement('div'); @@ -132,7 +135,7 @@ export class Decoration extends Disposable implements IDecoration { if (!this.marker.isDisposed) { this.marker.dispose(); } - if (this._element) { + if (this._element && this._container.contains(this._element)) { this._container.removeChild(this._element); } this.isDisposed = true; @@ -143,14 +146,14 @@ export class Decoration extends Disposable implements IDecoration { }); } - private _refreshStyle(renderService: IRenderService, altBufferActive?: boolean): void { + private _refreshStyle(renderService: IRenderService): void { const line = this.marker.line - this._bufferService.buffers.active.ydisp; if (line < 0 || line > this._bufferService.rows) { // outside of viewport this._element!.style.display = 'none'; } else { this._element!.style.top = `${line * renderService.dimensions.scaledCellHeight}px`; - this._element!.style.display = altBufferActive ? 'none' : 'block'; + this._element!.style.display = this._altBufferActive ? 'none' : 'block'; } } } From e720643315a6e96d1c456156286e0adadef069e8 Mon Sep 17 00:00:00 2001 From: meganrogge Date: Fri, 11 Feb 2022 17:04:11 -0600 Subject: [PATCH 09/18] get rid of unused --- src/browser/services/DecorationService.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/browser/services/DecorationService.ts b/src/browser/services/DecorationService.ts index d2096159..2ea16429 100644 --- a/src/browser/services/DecorationService.ts +++ b/src/browser/services/DecorationService.ts @@ -16,11 +16,7 @@ export class DecorationService extends Disposable implements IDecorationService private _screenElement: HTMLElement | undefined; private _renderService: IRenderService | undefined; - constructor( - @IInstantiationService private readonly _instantiationService: IInstantiationService, - @IBufferService private readonly _bufferService: IBufferService) { - super(); - } + constructor(@IInstantiationService private readonly _instantiationService: IInstantiationService) { super(); } public attachToDom(screenElement: HTMLElement, renderService: IRenderService): void { this._renderService = renderService; @@ -120,7 +116,8 @@ export class Decoration extends Disposable implements IDecoration { this._element.style.top = `${(this.marker.line - this._bufferService.buffers.active.ydisp) * renderService.dimensions.scaledCellHeight}px`; if (this.x && this.x > this._bufferService.cols) { - this._element!.style.display = 'none'; + // 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` : ''; @@ -147,13 +144,16 @@ export class Decoration extends Disposable implements IDecoration { } private _refreshStyle(renderService: IRenderService): void { + if (!this._element) { + return; + } const line = this.marker.line - this._bufferService.buffers.active.ydisp; if (line < 0 || line > this._bufferService.rows) { // outside of viewport - this._element!.style.display = 'none'; + this._element.style.display = 'none'; } else { - this._element!.style.top = `${line * renderService.dimensions.scaledCellHeight}px`; - this._element!.style.display = this._altBufferActive ? 'none' : 'block'; + this._element.style.top = `${line * renderService.dimensions.scaledCellHeight}px`; + this._element.style.display = this._altBufferActive ? 'none' : 'block'; } } } From 8dfed8f979093b5c6a73e055324033214e07a387 Mon Sep 17 00:00:00 2001 From: meganrogge Date: Fri, 11 Feb 2022 17:08:08 -0600 Subject: [PATCH 10/18] be safe and check if container contains element before removing --- src/browser/services/DecorationService.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/browser/services/DecorationService.ts b/src/browser/services/DecorationService.ts index 2ea16429..28785224 100644 --- a/src/browser/services/DecorationService.ts +++ b/src/browser/services/DecorationService.ts @@ -106,7 +106,7 @@ export class Decoration extends Disposable implements IDecoration { } private _createElement(renderService: IRenderService, shouldRecreate?: boolean): void { - if (shouldRecreate && this._element) { + if (shouldRecreate && this._element && this._container.contains(this._element)) { this._container.removeChild(this._element); } this._element = document.createElement('div'); From 8098fd8d013624dbbbc57289d335c68178062c2c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 13 Feb 2022 12:22:04 +0000 Subject: [PATCH 11/18] Bump follow-redirects in /addons/xterm-addon-ligatures Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.14.7 to 1.14.8. - [Release notes](https://github.com/follow-redirects/follow-redirects/releases) - [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.14.7...v1.14.8) --- updated-dependencies: - dependency-name: follow-redirects dependency-type: indirect ... Signed-off-by: dependabot[bot] --- addons/xterm-addon-ligatures/yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/xterm-addon-ligatures/yarn.lock b/addons/xterm-addon-ligatures/yarn.lock index ef052e86..64117742 100644 --- a/addons/xterm-addon-ligatures/yarn.lock +++ b/addons/xterm-addon-ligatures/yarn.lock @@ -67,9 +67,9 @@ fd-slicer@~1.1.0: pend "~1.2.0" follow-redirects@^1.14.0: - version "1.14.7" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.7.tgz#2004c02eb9436eee9a21446a6477debf17e81685" - integrity sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ== + version "1.14.8" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.8.tgz#016996fb9a11a100566398b1c6839337d7bfa8fc" + integrity sha512-1x0S9UVJHsQprFcEC/qnNzBLcIxsjAV905f/UkQxbclCsoTWlacCNOpQa/anodLl2uaEKFhfWOvM2Qg77+15zA== font-finder@^1.0.3: version "1.0.4" From 9847dcaaccf4dd773b4187525848a6a51b940f97 Mon Sep 17 00:00:00 2001 From: meganrogge Date: Tue, 15 Feb 2022 11:38:04 -0600 Subject: [PATCH 12/18] 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 13/18] 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 14/18] 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 15/18] 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'; } } } From 5b44deaa30e665a3d99a4259a7429792ea1661d8 Mon Sep 17 00:00:00 2001 From: meganrogge Date: Fri, 18 Feb 2022 15:38:07 -0600 Subject: [PATCH 16/18] get rid of markers once they've been disposed via clear --- src/common/buffer/Buffer.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/common/buffer/Buffer.ts b/src/common/buffer/Buffer.ts index 17831f39..1ba76ba1 100644 --- a/src/common/buffer/Buffer.ts +++ b/src/common/buffer/Buffer.ts @@ -591,10 +591,12 @@ export class Buffer implements IBuffer { for (const marker of this.markers.filter(m => m.line === y)) { marker.dispose(); } + this.markers = this.markers.filter(m => m.line !== y); } else { for (const marker of this.markers) { marker.dispose(); } + this.markers = []; } this._isClearing = false; } From a4fee6d4b5c8dd4f740cdf0b5e221377020c1f34 Mon Sep 17 00:00:00 2001 From: meganrogge Date: Fri, 18 Feb 2022 16:11:00 -0600 Subject: [PATCH 17/18] get rid of the bane of my existence --- src/common/InputHandler.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/common/InputHandler.ts b/src/common/InputHandler.ts index 0df992c8..6198aa37 100644 --- a/src/common/InputHandler.ts +++ b/src/common/InputHandler.ts @@ -1218,7 +1218,6 @@ export class InputHandler extends Disposable implements IInputHandler { this._activeBuffer.getNullCell(this._eraseAttrData()), this._eraseAttrData() ); - this._bufferService.buffer.clearMarkers(y); if (clearWrap) { line.isWrapped = false; } From f839a0da8baa212f6a25c22c4ff51df7c042c0ac Mon Sep 17 00:00:00 2001 From: meganrogge Date: Fri, 18 Feb 2022 17:50:12 -0600 Subject: [PATCH 18/18] use splice instead of filter --- 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 1ba76ba1..266c16aa 100644 --- a/src/common/buffer/Buffer.ts +++ b/src/common/buffer/Buffer.ts @@ -590,8 +590,8 @@ export class Buffer implements IBuffer { if (y) { for (const marker of this.markers.filter(m => m.line === y)) { marker.dispose(); + this.markers.splice(this.markers.indexOf(marker), 1); } - this.markers = this.markers.filter(m => m.line !== y); } else { for (const marker of this.markers) { marker.dispose();