From 324ea2ecb7adf6ef145de73310e85c3cc692c0d2 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 11 May 2022 09:54:40 -0700 Subject: [PATCH] Clean up/resolve todos --- src/browser/renderer/dom/DomRendererRowFactory.ts | 1 - src/browser/services/RenderService.ts | 9 ++++++--- src/common/services/DecorationService.ts | 1 - 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/browser/renderer/dom/DomRendererRowFactory.ts b/src/browser/renderer/dom/DomRendererRowFactory.ts index c92f82c6..71dc782a 100644 --- a/src/browser/renderer/dom/DomRendererRowFactory.ts +++ b/src/browser/renderer/dom/DomRendererRowFactory.ts @@ -197,7 +197,6 @@ export class DomRendererRowFactory { if (cell.isBold() && fg < 8 && this._optionsService.rawOptions.drawBoldTextInBrightColors) { fg += 8; } - // TODO: Pass in bg override if (!this._applyMinimumContrast(charElement, this._colors.background, this._colors.ansi[fg], cell, undefined, undefined)) { charElement.classList.add(`xterm-fg-${fg}`); } diff --git a/src/browser/services/RenderService.ts b/src/browser/services/RenderService.ts index a789e025..b2e619fe 100644 --- a/src/browser/services/RenderService.ts +++ b/src/browser/services/RenderService.ts @@ -68,14 +68,17 @@ export class RenderService extends Disposable implements IRenderService { this._screenDprMonitor.setListener(() => this.onDevicePixelRatioChange()); this.register(this._screenDprMonitor); - // TODO: This will slow things down - this.register(decorationService.onDecorationRegistered(() => this._fullRefresh())); - this.register(decorationService.onDecorationRemoved(() => this._fullRefresh())); this.register(bufferService.onResize(() => this._fullRefresh())); this.register(bufferService.buffers.onBufferActivate(() => this._renderer?.clear())); this.register(optionsService.onOptionChange(() => this._renderer.onOptionsChanged())); this.register(this._charSizeService.onCharSizeChange(() => this.onCharSizeChanged())); + // Do a full refresh whenever any decoration is added or removed. This may not actually result + // in changes but since decorations should be used sparingly or added/removed all in the same + // frame this should have minimal performance impact. + this.register(decorationService.onDecorationRegistered(() => this._fullRefresh())); + this.register(decorationService.onDecorationRemoved(() => this._fullRefresh())); + // No need to register this as renderer is explicitly disposed in RenderService.dispose this._renderer.onRequestRedraw(e => this.refreshRows(e.start, e.end, true)); diff --git a/src/common/services/DecorationService.ts b/src/common/services/DecorationService.ts index 58718333..e32abdce 100644 --- a/src/common/services/DecorationService.ts +++ b/src/common/services/DecorationService.ts @@ -68,7 +68,6 @@ export class DecorationService extends Disposable implements IDecorationService let xmin = 0; let xmax = 0; for (const d of this._decorations.getKeyIterator(line)) { - console.log('d', d); xmin = d.options.x ?? 0; xmax = xmin + (d.options.width ?? 1); if (x >= xmin && x < xmax) {