From 3dc4f1a7f2edbb06496494679e56d2a4aac18954 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Mon, 14 Mar 2022 15:56:27 -0700 Subject: [PATCH] Remove old decoration elements --- src/browser/Decorations/BufferDecorationRenderer.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/browser/Decorations/BufferDecorationRenderer.ts b/src/browser/Decorations/BufferDecorationRenderer.ts index 2f91d968..74fc59a7 100644 --- a/src/browser/Decorations/BufferDecorationRenderer.ts +++ b/src/browser/Decorations/BufferDecorationRenderer.ts @@ -34,6 +34,7 @@ export class BufferDecorationRenderer extends Disposable { this._altBufferIsActive = this._bufferService.buffer === this._bufferService.buffers.alt; })); this.register(this._decorationService.onDecorationRegistered(() => this._queueRefresh())); + this.register(this._decorationService.onDecorationRemoved(decoration => this._removeDecoration(decoration))); } public override dispose(): void { @@ -101,4 +102,10 @@ export class BufferDecorationRenderer extends Disposable { element.style.display = this._altBufferIsActive ? 'none' : 'block'; } } + + private _removeDecoration(decoration: IInternalDecoration): void { + const element = this._decorationElements.get(decoration); + element?.remove(); + this._decorationElements.delete(decoration); + } }