提交 b893f491 编写于 作者: D Daniel Imms

Fix various issues when the terminal was not open on launch

Fixes #11969
上级 fec1d6a4
......@@ -22,6 +22,7 @@
display: flex;
padding: 0 20px;
flex-grow: 1;
width: 100%;
}
.monaco-workbench .panel.integrated-terminal .terminal-wrapper {
......
......@@ -38,6 +38,7 @@ export class TerminalInstance implements ITerminalInstance {
public get onTitleChanged(): Event<string> { return this._onTitleChanged.event; }
private isExiting: boolean = false;
private isVisible: boolean = false;
private toDispose: lifecycle.IDisposable[] = [];
private skipTerminalKeybindings: Keybinding[] = [];
private process: cp.ChildProcess;
......@@ -74,6 +75,7 @@ export class TerminalInstance implements ITerminalInstance {
throw new Error('The terminal instance has already been attached to a container');
}
this.container = container;
this.wrapperElement = document.createElement('div');
DOM.addClass(this.wrapperElement, 'terminal-wrapper');
this.xtermElement = document.createElement('div');
......@@ -139,6 +141,7 @@ export class TerminalInstance implements ITerminalInstance {
this.container.appendChild(this.wrapperElement);
this.layout(new Dimension(this.container.offsetWidth, this.container.offsetHeight));
this.setVisible(this.isVisible);
}
public copySelection(): void {
......@@ -195,7 +198,10 @@ export class TerminalInstance implements ITerminalInstance {
}
public setVisible(visible: boolean): void {
DOM.toggleClass(this.wrapperElement, 'active', visible);
this.isVisible = visible;
if (this.wrapperElement) {
DOM.toggleClass(this.wrapperElement, 'active', visible);
}
}
public scrollDown(): void {
......
......@@ -72,6 +72,8 @@ export class TerminalPanel extends Panel {
this.updateTheme();
this.updateConfig();
// Force another layout (first is setContainers) since config has changed
this.layout(new Dimension(this.terminalContainer.offsetWidth, this.terminalContainer.offsetHeight));
return TPromise.as(void 0);
}
......
......@@ -143,11 +143,11 @@ export class TerminalService implements ITerminalService {
}
public setContainers(panelContainer: Builder, terminalContainer: HTMLElement): void {
this._configHelper.panelContainer = panelContainer;
this.terminalContainer = terminalContainer;
this._terminalInstances.forEach(terminalInstance => {
terminalInstance.attachToElement(this.terminalContainer);
});
this._configHelper.panelContainer = panelContainer;
}
public showPanel(focus?: boolean): TPromise<void> {
......@@ -155,7 +155,6 @@ export class TerminalService implements ITerminalService {
let panel = this.panelService.getActivePanel();
if (!panel || panel.getId() !== TERMINAL_PANEL_ID) {
return this.panelService.openPanel(TERMINAL_PANEL_ID, focus).then(() => {
panel = this.panelService.getActivePanel();
if (focus) {
this.getActiveInstance().focus(true);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册