Skip to content

Commit

Permalink
fix #141403
Browse files Browse the repository at this point in the history
  • Loading branch information
meganrogge committed Feb 1, 2022
1 parent 6578db0 commit ac1bac6
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
7 changes: 6 additions & 1 deletion src/vs/workbench/contrib/terminal/browser/media/terminal.css
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,18 @@
.monaco-workbench .pane-body.integrated-terminal .xterm {
/* All terminals have at least 10px left/right edge padding and 2 padding on the bottom (so underscores on last line are visible */
padding: 0 10px 2px;
/* Bottom align the terminal withing the split pane */
/* Bottom align the terminal within the split pane */
position: absolute;
bottom: 0;
left: 0;
right: 0;
}

.vertical .terminal.xterm {
/* Top align the terminal within the split pane when the panel is vertical */
top: 0;
}

.monaco-workbench .editor-instance .terminal-wrapper.fixed-dims .xterm,
.monaco-workbench .pane-body.integrated-terminal .terminal-wrapper.fixed-dims .xterm {
position: static;
Expand Down
25 changes: 18 additions & 7 deletions src/vs/workbench/contrib/terminal/browser/terminalTabbedView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,15 @@ import { TerminalContextKeys } from 'vs/workbench/contrib/terminal/common/termin

const $ = dom.$;

const FIND_FOCUS_CLASS = 'find-focused';
const STATUS_ICON_WIDTH = 30;
const SPLIT_ANNOTATION_WIDTH = 30;
const enum Class {
ViewIsVertical = 'vertical',
FindFocus = 'find-focused'
}

const enum Width {
StatusIcon = 30,
SplitAnnotation = 30
}

export class TerminalTabbedView extends Disposable {

Expand Down Expand Up @@ -129,13 +135,18 @@ export class TerminalTabbedView extends Disposable {
this._register(this._themeService.onDidColorThemeChange(theme => this._updateTheme(theme)));
this._updateTheme();

this._findWidget.focusTracker.onDidFocus(() => this._terminalContainer.classList.add(FIND_FOCUS_CLASS));
this._findWidget.focusTracker.onDidBlur(() => this._terminalContainer.classList.remove(FIND_FOCUS_CLASS));
this._findWidget.focusTracker.onDidFocus(() => this._terminalContainer.classList.add(Class.FindFocus));
this._findWidget.focusTracker.onDidBlur(() => this._terminalContainer.classList.remove(Class.FindFocus));

this._attachEventListeners(parentElement, this._terminalContainer);

this._terminalGroupService.onDidChangePanelOrientation((orientation) => {
this._panelOrientation = orientation;
if (this._panelOrientation === Orientation.VERTICAL) {
this._terminalContainer.classList.add(Class.ViewIsVertical);
} else {
this._terminalContainer.classList.remove(Class.ViewIsVertical);
}
});

this._splitView = new SplitView(parentElement, { orientation: Orientation.HORIZONTAL, proportionalLayout: false });
Expand Down Expand Up @@ -223,8 +234,8 @@ export class TerminalTabbedView extends Disposable {
private _getAdditionalWidth(instance: ITerminalInstance): number {
// Size to include padding, icon, status icon (if any), split annotation (if any), + a little more
const additionalWidth = 40;
const statusIconWidth = instance.statusList.statuses.length > 0 ? STATUS_ICON_WIDTH : 0;
const splitAnnotationWidth = (this._terminalGroupService.getGroupForInstance(instance)?.terminalInstances.length || 0) > 1 ? SPLIT_ANNOTATION_WIDTH : 0;
const statusIconWidth = instance.statusList.statuses.length > 0 ? Width.StatusIcon : 0;
const splitAnnotationWidth = (this._terminalGroupService.getGroupForInstance(instance)?.terminalInstances.length || 0) > 1 ? Width.SplitAnnotation : 0;
return additionalWidth + splitAnnotationWidth + statusIconWidth;
}

Expand Down

0 comments on commit ac1bac6

Please sign in to comment.