This commit is contained in:
meganrogge
2021-06-15 14:54:16 -07:00
parent 5ab03be9fb
commit ff14d2000c
5 changed files with 25 additions and 35 deletions
@@ -39,27 +39,34 @@
position: absolute;
top: 0;
}
.monaco-workbench .terminal-group .monaco-split-view2.horizontal .split-view-view:first-child .terminal-wrapper {
.monaco-workbench .editor-instance .terminal-group .monaco-split-view2.horizontal .split-view-view:first-child .terminal-wrapper,
.monaco-workbench .pane-body.integrated-terminal .terminal-group .monaco-split-view2.horizontal .split-view-view:first-child .terminal-wrapper {
margin-left: 20px;
}
.monaco-workbench .terminal-group .monaco-split-view2.horizontal .split-view-view:last-child .terminal-wrapper {
.monaco-workbench .editor-instance .terminal-group .monaco-split-view2.horizontal .split-view-view:last-child .terminal-wrapper,
.monaco-workbench .pane-body.integrated-terminal .terminal-group .monaco-split-view2.horizontal .split-view-view:last-child .terminal-wrapper {
margin-right: 20px;
}
.monaco-workbench .xterm a:not(.xterm-invalid-link) {
.monaco-workbench .editor-instance .xterm a:not(.xterm-invalid-link),
.monaco-workbench .pane-body.integrated-terminal .xterm a:not(.xterm-invalid-link) {
/* To support message box sizing */
position: relative;
}
.monaco-workbench .terminal-wrapper > div {
.monaco-workbench .editor-instance .terminal-wrapper > div,
.monaco-workbench .pane-body.integrated-terminal .terminal-wrapper > div {
height: 100%;
}
.monaco-workbench .xterm-viewport {
.monaco-workbench .editor-instance .xterm-viewport,
.monaco-workbench .pane-body.integrated-terminal .xterm-viewport {
box-sizing: border-box;
margin-right: -10px;
}
.monaco-workbench .terminal-group .monaco-split-view2.horizontal .split-view-view:last-child .xterm-viewport {
.monaco-workbench .editor-instance .terminal-group .monaco-split-view2.horizontal .split-view-view:last-child .xterm-viewport,
.monaco-workbench .pane-body.integrated-terminal .terminal-group .monaco-split-view2.horizontal .split-view-view:last-child .xterm-viewport {
margin-right: -20px;
}
@@ -102,7 +102,6 @@ export interface ICreateTerminalOptions {
* profile will be used.
*/
config?: IShellLaunchConfig | ITerminalProfile;
// TODO: Ensure this is supported for profiles
/**
* The current working directory to start with, this will override IShellLaunchConfig.cwd if
* specified.
@@ -20,10 +20,19 @@ export class TerminalEditor extends EditorPane {
public static readonly ID = 'terminalEditor';
private _parentElement: HTMLElement | undefined;
private _editorInput?: TerminalEditorInput = undefined;
private _lastDimension?: Dimension;
constructor(
@ITelemetryService telemetryService: ITelemetryService,
@IThemeService themeService: IThemeService,
@IStorageService storageService: IStorageService,
) {
super(TerminalEditor.ID, telemetryService, themeService, storageService);
}
override async setInput(newInput: TerminalEditorInput, options: IEditorOptions | undefined, context: IEditorOpenContext, token: CancellationToken) {
this._editorInput?.terminalInstance?.detachFromElement();
this._editorInput = newInput;
@@ -49,21 +58,9 @@ export class TerminalEditor extends EditorPane {
override setVisible(visible: boolean, group?: IEditorGroup): void {
super.setVisible(visible, group);
if (!this._editorInput?.terminalInstance) {
return;
}
this._editorInput.terminalInstance.setVisible(visible);
return this._editorInput?.terminalInstance?.setVisible(visible);
}
constructor(
@ITelemetryService telemetryService: ITelemetryService,
@IThemeService themeService: IThemeService,
@IStorageService storageService: IStorageService,
) {
super(TerminalEditor.ID, telemetryService, themeService, storageService);
}
}
export class TerminalInputSerializer implements IEditorInputSerializer {
@@ -3,6 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { toDisposable } from 'vs/base/common/lifecycle';
import { URI } from 'vs/base/common/uri';
import { EditorInput } from 'vs/workbench/common/editor/editorInput';
import { ITerminalInstance } from 'vs/workbench/contrib/terminal/browser/terminal';
@@ -31,14 +32,10 @@ export class TerminalEditorInput extends EditorInput {
super();
this._terminalInstance = terminalInstance;
this._terminalInstance.onTitleChanged(() => this._onDidChangeLabel.fire());
this._register(toDisposable(() => this.terminalInstance.dispose()));
}
override getName() {
return this.terminalInstance.title;
}
override dispose() {
this.terminalInstance.dispose();
super.dispose();
}
}
@@ -629,16 +629,6 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
return xterm;
}
reattachToElement(container: HTMLElement): void {
if (!this._wrapperElement) {
throw new Error('The terminal instance has not been attached to a container yet');
}
this._wrapperElement.parentNode?.removeChild(this._wrapperElement);
this._container = container;
this._container.appendChild(this._wrapperElement);
}
detachFromElement(): void {
this._wrapperElement?.parentNode?.removeChild(this._wrapperElement);
this._wrapperElement = undefined;