diff --git a/src/vs/base/browser/ui/splitview/splitview.ts b/src/vs/base/browser/ui/splitview/splitview.ts index 833a21808031dcd0c4f29c67693d208f715bf02b..0f6501b4cc62bc5113c12db69b44c8435c857d91 100644 --- a/src/vs/base/browser/ui/splitview/splitview.ts +++ b/src/vs/base/browser/ui/splitview/splitview.ts @@ -91,6 +91,8 @@ export class SplitView implements IDisposable { private _onDidSashChange = new Emitter(); readonly onDidSashChange = this._onDidSashChange.event; + private _onDidSashReset = new Emitter(); + readonly onDidSashReset = this._onDidSashReset.event; get length(): number { return this.viewItems.length; @@ -153,8 +155,10 @@ export class SplitView implements IDisposable { const onSashChangeDisposable = onChange(this.onSashChange, this); const onEnd = mapEvent(sash.onDidEnd, () => null); const onEndDisposable = onEnd(() => this._onDidSashChange.fire()); + const onDidReset = mapEvent(sash.onDidReset, () => null); + const onDidResetDisposable = onDidReset(() => this._onDidSashReset.fire()); - const disposable = combinedDisposable([onStartDisposable, onSashChangeDisposable, onEndDisposable, sash]); + const disposable = combinedDisposable([onStartDisposable, onSashChangeDisposable, onEndDisposable, onDidResetDisposable, sash]); const sashItem: ISashItem = { sash, disposable }; this.sashItems.splice(index - 1, 0, sashItem); diff --git a/src/vs/workbench/parts/terminal/electron-browser/terminalTab.ts b/src/vs/workbench/parts/terminal/electron-browser/terminalTab.ts index e423096efa10cc287aa3971cc49acb798722991e..801aca5ad1073b02d18f2fae2e7dc3c7ee7a01f5 100644 --- a/src/vs/workbench/parts/terminal/electron-browser/terminalTab.ts +++ b/src/vs/workbench/parts/terminal/electron-browser/terminalTab.ts @@ -42,6 +42,7 @@ class SplitPane implements IView { container.removeChild((this.instance)._wrapperElement); this._splitView = new SplitView(container, { orientation }); + this._splitView.onDidSashReset(() => this._resetSize()); this.layout(this._size); this.orthogonalLayout(this.orthogonalSize); @@ -78,6 +79,17 @@ class SplitPane implements IView { this._onDidChange = anyEvent(...this._children.map(c => c.onDidChange)); } + private _resetSize(): void { + let totalSize = 0; + for (let i = 0; i < this._splitView.length; i++) { + totalSize += this._splitView.getViewSize(i); + } + const newSize = Math.floor(totalSize / this._splitView.length); + for (let i = 0; i < this._splitView.length - 1; i++) { + this._splitView.resizeView(i, newSize); + } + } + public remove(): void { if (!this._parent) { return;