From f820a2a63157bfb1b15aa503cd97b6fee9217b55 Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Sun, 31 Oct 2021 10:55:37 +0100 Subject: [PATCH] fixed scrollbar positioning on resize - fixes #4854 --- tabby-terminal/src/frontends/xtermFrontend.ts | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/tabby-terminal/src/frontends/xtermFrontend.ts b/tabby-terminal/src/frontends/xtermFrontend.ts index e984f42c..2872fef7 100644 --- a/tabby-terminal/src/frontends/xtermFrontend.ts +++ b/tabby-terminal/src/frontends/xtermFrontend.ts @@ -118,20 +118,8 @@ export class XTermFrontend extends Frontend { this.resizeHandler = () => { try { if (this.xterm.element && getComputedStyle(this.xterm.element).getPropertyValue('height') !== 'auto') { - const t = window.getComputedStyle(this.xterm.element.parentElement!) - const r = parseInt(t.getPropertyValue('height')) - const n = Math.max(0, parseInt(t.getPropertyValue('width'))) - const o = window.getComputedStyle(this.xterm.element) - const i = r - (parseInt(o.getPropertyValue('padding-top')) + parseInt(o.getPropertyValue('padding-bottom'))) - const l = n - (parseInt(o.getPropertyValue('padding-right')) + parseInt(o.getPropertyValue('padding-left'))) - this.xtermCore.viewport.scrollBarWidth - const actualCellWidth = this.xtermCore._renderService.dimensions.actualCellWidth || 9 - const actualCellHeight = this.xtermCore._renderService.dimensions.actualCellHeight || 17 - const cols = Math.floor(l / actualCellWidth) - const rows = Math.floor(i / actualCellHeight) - - if (!isNaN(cols) && !isNaN(rows)) { - this.xterm.resize(cols, rows) - } + this.fitAddon.fit() + this.xtermCore.viewport._refresh() } } catch (e) { // tends to throw when element wasn't shown yet -- GitLab