Skip to content

Commit

Permalink
fix #135687
Browse files Browse the repository at this point in the history
  • Loading branch information
meganrogge committed Nov 4, 2021
1 parent d0dcd79 commit 7af55d0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
20 changes: 16 additions & 4 deletions src/vs/platform/terminal/node/ptyService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export class PtyService extends Disposable implements IPtyService {
executableEnv,
windowsEnableConpty
};
const persistentProcess = new PersistentTerminalProcess(id, process, workspaceId, workspaceName, shouldPersist, cols, rows, processLaunchOptions, unicodeVersion, this._reconnectConstants, this._logService, isReviving ? shellLaunchConfig.initialText : undefined, shellLaunchConfig.icon, shellLaunchConfig.color, shellLaunchConfig.fixedDimensions);
const persistentProcess = new PersistentTerminalProcess(id, process, workspaceId, workspaceName, shouldPersist, cols, rows, processLaunchOptions, unicodeVersion, this._reconnectConstants, this._logService, isReviving ? shellLaunchConfig.initialText : undefined, shellLaunchConfig.icon, shellLaunchConfig.color, shellLaunchConfig.name, shellLaunchConfig.fixedDimensions);
process.onDidChangeProperty(property => this._onDidChangeProperty.fire({ id, property }));
process.onProcessExit(event => {
persistentProcess.dispose();
Expand Down Expand Up @@ -425,7 +425,12 @@ export class PersistentTerminalProcess extends Disposable {
private _fixedDimensions: IFixedTerminalDimensions | undefined;

get pid(): number { return this._pid; }
get shellLaunchConfig(): IShellLaunchConfig { return this._terminalProcess.shellLaunchConfig; }
get shellLaunchConfig(): IShellLaunchConfig {
this._terminalProcess.shellLaunchConfig.color = this.color;
this._terminalProcess.shellLaunchConfig.icon = this.icon;
this._terminalProcess.shellLaunchConfig.name = this.title;
return this._terminalProcess.shellLaunchConfig;
}
get title(): string { return this._title || this._terminalProcess.currentTitle; }
get titleSource(): TitleEventSource { return this._titleSource; }
get icon(): TerminalIcon | undefined { return this._icon; }
Expand All @@ -437,8 +442,10 @@ export class PersistentTerminalProcess extends Disposable {
this._titleSource = titleSource;
}

setIcon(icon: TerminalIcon, color?: string): void {
this._icon = icon;
setIcon(icon?: TerminalIcon, color?: string): void {
if (icon) {
this._icon = icon;
}
this._color = color;
}

Expand All @@ -461,9 +468,14 @@ export class PersistentTerminalProcess extends Disposable {
reviveBuffer: string | undefined,
private _icon?: TerminalIcon,
private _color?: string,
name?: string,
fixedDimensions?: IFixedTerminalDimensions
) {
super();
this.setIcon(_icon, _color);
if (name) {
this.setTitle(name, TitleEventSource.Api);
}
this._logService.trace('persistentTerminalProcess#ctor', _persistentProcessId, arguments);
this._wasRevived = reviveBuffer !== undefined;
this._serializer = new XtermSerializer(
Expand Down
14 changes: 3 additions & 11 deletions src/vs/workbench/contrib/terminal/browser/terminalInstance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -408,24 +408,16 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
}

private _getIcon(): TerminalIcon | undefined {
const icon = this._shellLaunchConfig.icon || this._shellLaunchConfig.attachPersistentProcess?.icon;
const icon = this._shellLaunchConfig.attachPersistentProcess?.icon || this._shellLaunchConfig.icon;
if (!icon) {
return this._processManager.processState >= ProcessState.Launching ? Codicon.terminal : undefined;
}
return icon;
}

private _getColor(): string | undefined {
if (this.shellLaunchConfig.color) {
return this.shellLaunchConfig.color;
}
if (this.shellLaunchConfig?.attachPersistentProcess?.color) {
return this.shellLaunchConfig.attachPersistentProcess.color;
}
if (this._processManager.processState >= ProcessState.Launching) {
return undefined;
}
return undefined;

return this.shellLaunchConfig?.attachPersistentProcess?.color || this.shellLaunchConfig?.color || undefined;
}

addDisposable(disposable: IDisposable): void {
Expand Down

0 comments on commit 7af55d0

Please sign in to comment.