From 6f148ab5f93da761b69fe6e8ed27f4794a6781ad Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 14 Jul 2021 14:44:35 -0700 Subject: [PATCH] Resize terminal when it's shown This fixes the following case: 1. Create and split the terminal 2. Hide the panel 3. Create a terminal in the background 4. Show it, the dimensions were wrong --- .../workbench/contrib/terminal/browser/terminalInstance.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts b/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts index 396b0feeca39b..c44705b3e76ef 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts @@ -1072,6 +1072,11 @@ export class TerminalInstance extends Disposable implements ITerminalInstance { this._wrapperElement.classList.toggle('active', visible); } if (visible && this._xterm && this._xtermCore) { + // Resize to re-evaluate dimensions, this will ensure when switching to a terminal it is + // using the most up to date dimensions (eg. when terminal is created in the background + // using cached dimensions of a split terminal). + this._resize(); + // Trigger a manual scroll event which will sync the viewport and scroll bar. This is // necessary if the number of rows in the terminal has decreased while it was in the // background since scrollTop changes take no effect but the terminal's position does