Skip to content

Commit

Permalink
Fix resizing boundary terminal panes, increase min size
Browse files Browse the repository at this point in the history
Fixes #44675
  • Loading branch information
Tyriar committed Feb 28, 2018
1 parent a6dde81 commit 13ec47d
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/vs/workbench/parts/terminal/electron-browser/terminalTab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { IDisposable, Disposable } from 'vs/base/common/lifecycle';
import { SplitView, Orientation, IView } from 'vs/base/browser/ui/splitview/splitview';
import { IPartService, Position } from 'vs/workbench/services/part/common/partService';

const SPLIT_PANE_MIN_SIZE = 60;

class SplitPaneContainer {
private _height: number;
private _width: number;
Expand Down Expand Up @@ -98,10 +100,17 @@ class SplitPaneContainer {
} else if (!isSizingEndPane && direction === Direction.Down) {
amount *= -1;
}

// Ensure the size is not reduced beyond the minimum, otherwise weird things can happen
if (sizes[index] + amount < SPLIT_PANE_MIN_SIZE) {
amount = SPLIT_PANE_MIN_SIZE - sizes[index];
} else if (sizes[indexToChange] - amount < SPLIT_PANE_MIN_SIZE) {
amount = sizes[indexToChange] - SPLIT_PANE_MIN_SIZE;
}

// Apply the size change
sizes[index] += amount;
sizes[indexToChange] -= amount;

// Apply
for (let i = 0; i < this._splitView.length - 1; i++) {
this._splitView.resizeView(i, sizes[i]);
}
Expand Down Expand Up @@ -192,7 +201,7 @@ class SplitPaneContainer {
}

class SplitPane implements IView {
public minimumSize: number = 40;
public minimumSize: number = SPLIT_PANE_MIN_SIZE;
public maximumSize: number = Number.MAX_VALUE;

public instance: ITerminalInstance;
Expand Down

0 comments on commit 13ec47d

Please sign in to comment.