Skip to content

Commit 86d5aba

Browse files
committed
Fix background terminal split layouts breaking when orientation change
Fixes microsoft#44678
1 parent 9a94030 commit 86d5aba

1 file changed

Lines changed: 7 additions & 10 deletions

File tree

src/vs/workbench/parts/terminal/electron-browser/terminalTab.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class SplitPaneContainer {
4141
private _createSplitView(): void {
4242
this._splitView = new SplitView(this._container, { orientation: this.orientation });
4343
this._splitViewDisposables = [];
44-
this._splitViewDisposables.push(this._splitView.onDidSashReset(() => this._resetSize()));
44+
this._splitViewDisposables.push(this._splitView.onDidSashReset(() => this.resetSize()));
4545
this._splitViewDisposables.push(this._splitView.onDidSashChange(() => {
4646
this._isManuallySized = true;
4747
}));
@@ -52,7 +52,7 @@ class SplitPaneContainer {
5252
this._addChild(size / (this._children.length + 1), instance, index);
5353
}
5454

55-
private _resetSize(): void {
55+
public resetSize(): void {
5656
// TODO: Optimize temrinal instance layout
5757
let totalSize = 0;
5858
for (let i = 0; i < this._splitView.length; i++) {
@@ -120,7 +120,7 @@ class SplitPaneContainer {
120120
this._children.push(child);
121121
}
122122

123-
this._resetSize();
123+
this.resetSize();
124124
this._refreshOrderClasses();
125125

126126
this._onDidChange = anyEvent(...this._children.map(c => c.onDidChange));
@@ -136,7 +136,7 @@ class SplitPaneContainer {
136136
if (index !== null) {
137137
this._children.splice(index, 1);
138138
this._splitView.removeView(index);
139-
this._resetSize();
139+
this.resetSize();
140140
this._refreshOrderClasses();
141141
}
142142
}
@@ -155,7 +155,7 @@ class SplitPaneContainer {
155155

156156
public layout(width: number, height: number): void {
157157
if (!this._isManuallySized) {
158-
this._resetSize();
158+
this.resetSize();
159159
}
160160
this._width = width;
161161
this._height = height;
@@ -188,10 +188,6 @@ class SplitPaneContainer {
188188
child.orientation = orientation;
189189
this._splitView.addView(child, 1);
190190
});
191-
192-
// Allow time for a layout to occur
193-
this.layout(this._container.offsetWidth, this._container.offsetHeight);
194-
this._resetSize();
195191
}
196192
}
197193

@@ -435,10 +431,11 @@ export class TerminalTab extends Disposable implements ITerminalTab {
435431
if (newPanelPosition !== this._panelPosition) {
436432
const newOrientation = newPanelPosition === Position.BOTTOM ? Orientation.HORIZONTAL : Orientation.VERTICAL;
437433
this._splitPaneContainer.setOrientation(newOrientation);
434+
this._panelPosition = newPanelPosition;
438435
}
439-
this._panelPosition = newPanelPosition;
440436

441437
this._splitPaneContainer.layout(width, height);
438+
this._splitPaneContainer.resetSize();
442439
}
443440
}
444441

0 commit comments

Comments
 (0)