Add fixed-dims class

This commit is contained in:
Daniel Imms
2021-11-05 08:29:05 -07:00
parent ab97bc8b0b
commit ea074f283a
2 changed files with 9 additions and 7 deletions
@@ -56,8 +56,8 @@
right: 0;
}
.monaco-workbench .editor-instance .terminal-split-pane > .monaco-scrollable-element > .terminal-wrapper .xterm,
.monaco-workbench .pane-body.integrated-terminal .terminal-split-pane > .monaco-scrollable-element > .terminal-wrapper .xterm {
.monaco-workbench .editor-instance .terminal-wrapper.fixed-dims .xterm,
.monaco-workbench .pane-body.integrated-terminal .terminal-wrapper.fixed-dims .xterm {
position: static;
}
@@ -132,15 +132,15 @@
box-sizing: border-box;
}
.monaco-workbench .editor-instance .terminal-split-pane > .monaco-scrollable-element > .terminal-wrapper,
.monaco-workbench .pane-body.integrated-terminal .terminal-split-pane > .monaco-scrollable-element > .terminal-wrapper {
.monaco-workbench .editor-instance .terminal-wrapper.fixed-dims,
.monaco-workbench .pane-body.integrated-terminal .terminal-wrapper.fixed-dims {
/* The viewport should be positioned against this so it does't conflict with a fixed dimensions terminal horizontal scroll bar*/
position: relative;
}
/* TODO: Add class for fixed dimensions */
.monaco-workbench .editor-instance :not(.terminal-split-pane > .monaco-scrollable-element) > .terminal-wrapper .xterm-viewport,
.monaco-workbench .pane-body.integrated-terminal :not(.terminal-split-pane > .monaco-scrollable-element) > .terminal-wrapper .xterm-viewport {
.monaco-workbench .editor-instance .terminal-wrapper:not(.fixed-dims) .xterm-viewport,
.monaco-workbench .pane-body.integrated-terminal .terminal-wrapper:not(.fixed-dims) .xterm-viewport {
/* Override xterm.js' width as we want to size the viewport to fill the panel so the scrollbar is on the right edge */
width: auto !important;
}
@@ -1668,13 +1668,14 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
this.focus();
}
// TODO: Add fixed dimensions class
// TODO: Ideally don't set fixed rows when sizing to content
// TODO: Remove right padding when using fixed diemnsions
private async _addScrollbar(): Promise<void> {
const charWidth = (this.xterm ? this.xterm.getFont() : this._configHelper.getFont()).charWidth;
if (!this.xterm?.raw.element || !this._wrapperElement || !this._container || !charWidth || !this._fixedCols) {
return;
}
this._wrapperElement.classList.add('fixed-dims');
// TODO: Look into effects of this; fixed dims always have room for scrollbar
// if (this._fixedCols < this.xterm.raw.buffer.active.getLine(0)!.length) {
// // no scrollbar needed
@@ -1717,6 +1718,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
this._horizontalScrollbar?.dispose();
this._horizontalScrollbar = undefined;
this._wrapperElement.remove();
this._wrapperElement.classList.remove('fixed-dims');
this._container.appendChild(this._wrapperElement);
}