mirror of
https://github.com/Microsoft/vscode
synced 2024-09-19 02:26:04 +00:00
Merge pull request #173368 from rehmsen/terminal_welcome_view_switch
Layout when switching from welcome to terminal.
This commit is contained in:
commit
fb1c770dc5
|
@ -53,7 +53,6 @@ export class TerminalViewPane extends ViewPane {
|
|||
private _parentDomElement: HTMLElement | undefined;
|
||||
private _terminalTabbedView?: TerminalTabbedView;
|
||||
get terminalTabbedView(): TerminalTabbedView | undefined { return this._terminalTabbedView; }
|
||||
private _isWelcomeShowing: boolean = false;
|
||||
private _isInitialized: boolean = false;
|
||||
private _newDropdown: DropdownWithPrimaryActionViewItem | undefined;
|
||||
private readonly _dropdownMenu: IMenu;
|
||||
|
@ -87,13 +86,18 @@ export class TerminalViewPane extends ViewPane {
|
|||
}));
|
||||
|
||||
this._register(this._terminalService.onDidChangeInstances(() => {
|
||||
if (!this._isWelcomeShowing) {
|
||||
return;
|
||||
// If the first terminal is opened, hide the welcome view
|
||||
// and if the last one is closed, show it again
|
||||
if (this._hasWelcomeScreen() && this._terminalService.instances.length <= 1) {
|
||||
this._onDidChangeViewWelcomeState.fire();
|
||||
}
|
||||
this._isWelcomeShowing = true;
|
||||
this._onDidChangeViewWelcomeState.fire();
|
||||
if (!this._terminalTabbedView && this._parentDomElement) {
|
||||
if (!this._parentDomElement) { return; }
|
||||
// If we do not have the tab view yet, create it now.
|
||||
if (!this._terminalTabbedView) {
|
||||
this._createTabsView();
|
||||
}
|
||||
// If we just opened our first terminal, layout
|
||||
if (this._terminalService.instances.length === 1) {
|
||||
this.layoutBody(this._parentDomElement.offsetHeight, this._parentDomElement.offsetWidth);
|
||||
}
|
||||
}));
|
||||
|
@ -200,7 +204,7 @@ export class TerminalViewPane extends ViewPane {
|
|||
this._register(this.onDidChangeBodyVisibility(async visible => {
|
||||
this._viewShowing.set(visible);
|
||||
if (visible) {
|
||||
if (!this._terminalService.isProcessSupportRegistered) {
|
||||
if (this._hasWelcomeScreen()) {
|
||||
this._onDidChangeViewWelcomeState.fire();
|
||||
}
|
||||
this._initializeTerminal(false);
|
||||
|
@ -319,9 +323,12 @@ export class TerminalViewPane extends ViewPane {
|
|||
}
|
||||
}
|
||||
|
||||
private _hasWelcomeScreen(): boolean {
|
||||
return !this._terminalService.isProcessSupportRegistered;
|
||||
}
|
||||
|
||||
override shouldShowWelcome(): boolean {
|
||||
this._isWelcomeShowing = !this._terminalService.isProcessSupportRegistered && this._terminalService.instances.length === 0;
|
||||
return this._isWelcomeShowing;
|
||||
return this._hasWelcomeScreen() && this._terminalService.instances.length === 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue