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

Fix various issues when the terminal was not open on launch

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