From 19c1ee56d3b0deb521413182d1ce53294710e525 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Thu, 27 Oct 2022 13:55:24 -0700 Subject: [PATCH] Fix resize in demo A double resize could happen due to the mismatch in canvas vs device pixel widths Fixes #4113 --- demo/client.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/demo/client.ts b/demo/client.ts index fdb46f6c..18ce1808 100644 --- a/demo/client.ts +++ b/demo/client.ts @@ -615,10 +615,8 @@ function addDomListener(element: HTMLElement, type: string, handler: (...args: a } function updateTerminalSize(): void { - const cols = parseInt((document.getElementById(`opt-cols`) as HTMLInputElement).value, 10); - const rows = parseInt((document.getElementById(`opt-rows`) as HTMLInputElement).value, 10); - const width = (cols * term._core._renderService.dimensions.css.cell.width + term._core.viewport.scrollBarWidth).toString() + 'px'; - const height = (rows * term._core._renderService.dimensions.css.cell.height).toString() + 'px'; + const width = (term._core._renderService.dimensions.css.canvas.width + term._core.viewport.scrollBarWidth).toString() + 'px'; + const height = (term._core._renderService.dimensions.css.canvas.height).toString() + 'px'; terminalContainer.style.width = width; terminalContainer.style.height = height; addons.fit.instance.fit();