Skip to content

Commit

Permalink
Resize terminal when it's shown
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Tyriar committed Jul 14, 2021
1 parent 3bea1f0 commit 5e159d1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/vs/workbench/contrib/terminal/browser/terminalInstance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1060,6 +1060,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
Expand Down

0 comments on commit 5e159d1

Please sign in to comment.