From 8d4d5bd54ba76a12d25995cc47ab6f9808bfb390 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Fri, 21 Oct 2022 13:02:24 -0700 Subject: [PATCH] Fix dropped frame issue This ensures decorations are refreshed in the same frame when called from an animation frame callback Fixes #4225 --- src/browser/decorations/BufferDecorationRenderer.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/browser/decorations/BufferDecorationRenderer.ts b/src/browser/decorations/BufferDecorationRenderer.ts index d33115f7..e195c5ae 100644 --- a/src/browser/decorations/BufferDecorationRenderer.ts +++ b/src/browser/decorations/BufferDecorationRenderer.ts @@ -28,7 +28,7 @@ export class BufferDecorationRenderer extends Disposable { this._container.classList.add('xterm-decoration-container'); this._screenElement.appendChild(this._container); - this.register(this._renderService.onRenderedViewportChange(() => this._queueRefresh())); + this.register(this._renderService.onRenderedViewportChange(() => this._doRefreshDecorations())); this.register(this._renderService.onDimensionsChange(() => { this._dimensionsChanged = true; this._queueRefresh(); @@ -50,12 +50,12 @@ export class BufferDecorationRenderer extends Disposable { return; } this._animationFrame = this._renderService.addRefreshCallback(() => { - this.refreshDecorations(); + this._doRefreshDecorations(); this._animationFrame = undefined; }); } - public refreshDecorations(): void { + private _doRefreshDecorations(): void { for (const decoration of this._decorationService.decorations) { this._renderDecoration(decoration); }