Remove old decoration elements

This commit is contained in:
Daniel Imms
2022-03-14 15:56:27 -07:00
parent 65b9a6cfc4
commit 3dc4f1a7f2
@@ -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);
}
}