From 6891b4a0134775c20fd03f48b39d86cabba87c07 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Fri, 16 Feb 2018 13:50:55 -0800 Subject: [PATCH] Allow manual resizing of panes --- .../parts/terminal/electron-browser/terminalTab.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/vs/workbench/parts/terminal/electron-browser/terminalTab.ts b/src/vs/workbench/parts/terminal/electron-browser/terminalTab.ts index 2bffb957e9a..99852a131ce 100644 --- a/src/vs/workbench/parts/terminal/electron-browser/terminalTab.ts +++ b/src/vs/workbench/parts/terminal/electron-browser/terminalTab.ts @@ -19,6 +19,11 @@ class SplitPaneContainer { private _splitView: SplitView; private _children: SplitPane[] = []; + // If the user sizes the panes manually, the proportional resizing will not be applied. + // Proportional resizing will come back when: a sash is reset, an instance is added/removed or + // the panel position moves. + private _isManuallySized: boolean = false; + private _onDidChange: Event = Event.None; public get onDidChange(): Event { return this._onDidChange; } @@ -29,7 +34,9 @@ class SplitPaneContainer { this._width = this._container.offsetWidth; this._height = this._container.offsetHeight; this._splitView = new SplitView(this._container, { orientation: this.orientation }); + // TODO: Dispose listeners this._splitView.onDidSashReset(() => this._resetSize()); + this._splitView.onDidSashChange(() => this._isManuallySized = true); this._splitView.layout(this.orientation === Orientation.HORIZONTAL ? this._width : this._height); } @@ -39,6 +46,7 @@ class SplitPaneContainer { } private _resetSize(): void { + // TODO: Optimize temrinal instance layout let totalSize = 0; for (let i = 0; i < this._splitView.length; i++) { totalSize += this._splitView.getViewSize(i); @@ -47,6 +55,7 @@ class SplitPaneContainer { for (let i = 0; i < this._splitView.length - 1; i++) { this._splitView.resizeView(i, newSize); } + this._isManuallySized = false; } public resizePane(index: number, direction: Direction, amount: number): void { @@ -123,6 +132,9 @@ class SplitPaneContainer { } public layout(width: number, height: number): void { + if (!this._isManuallySized) { + this._resetSize(); + } this._width = width; this._height = height; if (this.orientation === Orientation.HORIZONTAL) { -- GitLab