Skip to content

Commit

Permalink
Fix resize in demo
Browse files Browse the repository at this point in the history
A double resize could happen due to the mismatch in canvas vs device
pixel widths

Fixes xtermjs#4113
  • Loading branch information
Tyriar committed Oct 27, 2022
1 parent a4f8b07 commit 19c1ee5
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions demo/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 19c1ee5

Please sign in to comment.