From 8d6aa11b268798de4739d15e991bd3b6f8f1e4e8 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Mon, 26 Sep 2016 13:34:25 -0700 Subject: [PATCH] Sync scroll bar after panel is toggled Fixes #12574 --- .../parts/terminal/electron-browser/terminalInstance.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts b/src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts index e6c4d68d127..f8ae910ce32 100644 --- a/src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts +++ b/src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts @@ -342,6 +342,12 @@ export class TerminalInstance implements ITerminalInstance { } if (!dimension.height) { // Minimized return; + } else { + // Trigger scroll event manually so that the viewport's scroll area is synced. This + // needs to happen otherwise its scrollTop value is invalid when the panel is toggled as + // it gets removed and then added back to the DOM (resetting scrollTop to 0). + // Upstream issue: https://github.com/sourcelair/xterm.js/issues/291 + this._xterm.emit('scroll', this._xterm.ydisp); } let leftPadding = parseInt(getComputedStyle(document.querySelector('.terminal-outer-container')).paddingLeft.split('px')[0], 10); let innerWidth = dimension.width - leftPadding; -- GitLab