From 0a14a2c3c7fb20f61840f9a5f3d48762c558ee5b Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Tue, 12 Nov 2024 03:53:29 -0800 Subject: [PATCH] Re-render after canvas device pixel dims change Fixes #227102 --- .../browser/viewParts/viewLinesGpu/viewLinesGpu.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/vs/editor/browser/viewParts/viewLinesGpu/viewLinesGpu.ts b/src/vs/editor/browser/viewParts/viewLinesGpu/viewLinesGpu.ts index 0f8e263c2b0f8..a033a5e4045a2 100644 --- a/src/vs/editor/browser/viewParts/viewLinesGpu/viewLinesGpu.ts +++ b/src/vs/editor/browser/viewParts/viewLinesGpu/viewLinesGpu.ts @@ -70,9 +70,18 @@ export class ViewLinesGpu extends ViewPart implements IViewLines { this.canvas = this._viewGpuContext.canvas.domNode; + // Re-render the following frame after canvas device pixel dimensions change, provided a + // new render does not occur. this._register(autorun(reader => { - /*const dims = */this._viewGpuContext.canvasDevicePixelDimensions.read(reader); - // TODO: Request render, should this just call renderText with the last viewportData + this._viewGpuContext.canvasDevicePixelDimensions.read(reader); + const lastViewportData = this._lastViewportData; + if (lastViewportData) { + setTimeout(() => { + if (lastViewportData === this._lastViewportData) { + this.renderText(lastViewportData); + } + }); + } })); this.initWebgpu();