Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use conpty while accessibility mode is enabled #173069

Merged
merged 1 commit into from
Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/vs/workbench/contrib/terminal/browser/terminalInstance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1554,7 +1554,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
this.xterm?.raw.resize(this._cols || Constants.DefaultCols, this._rows || Constants.DefaultRows);
}
const originalIcon = this.shellLaunchConfig.icon;
await this._processManager.createProcess(this._shellLaunchConfig, this._cols || Constants.DefaultCols, this._rows || Constants.DefaultRows, this._accessibilityService.isScreenReaderOptimized()).then(error => {
await this._processManager.createProcess(this._shellLaunchConfig, this._cols || Constants.DefaultCols, this._rows || Constants.DefaultRows).then(error => {
if (error) {
this._onProcessExit(error);
}
Expand Down Expand Up @@ -1802,7 +1802,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {

// Set the new shell launch config
this._shellLaunchConfig = shell; // Must be done before calling _createProcess()
await this._processManager.relaunch(this._shellLaunchConfig, this._cols || Constants.DefaultCols, this._rows || Constants.DefaultRows, this._accessibilityService.isScreenReaderOptimized(), reset).then(error => {
await this._processManager.relaunch(this._shellLaunchConfig, this._cols || Constants.DefaultCols, this._rows || Constants.DefaultRows, reset).then(error => {
if (error) {
this._onProcessExit(error);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ export class TerminalProcessManager extends Disposable implements ITerminalProce

private _shellLaunchConfig?: IShellLaunchConfig;
private _dimensions: ITerminalDimensions = { cols: 0, rows: 0 };
private _isScreenReaderModeEnabled: boolean = false;

private readonly _onPtyDisconnect = this._register(new Emitter<void>());
readonly onPtyDisconnect = this._onPtyDisconnect.event;
Expand Down Expand Up @@ -220,13 +219,11 @@ export class TerminalProcessManager extends Disposable implements ITerminalProce
shellLaunchConfig: IShellLaunchConfig,
cols: number,
rows: number,
isScreenReaderModeEnabled: boolean,
reset: boolean = true
): Promise<ITerminalLaunchError | undefined> {
this._shellLaunchConfig = shellLaunchConfig;
this._dimensions.cols = cols;
this._dimensions.rows = rows;
this._isScreenReaderModeEnabled = isScreenReaderModeEnabled;

let newProcess: ITerminalChildProcess | undefined;

Expand Down Expand Up @@ -283,7 +280,7 @@ export class TerminalProcessManager extends Disposable implements ITerminalProce
enabled: this._configurationService.getValue(TerminalSettingId.ShellIntegrationEnabled),
suggestEnabled: this._configurationService.getValue(TerminalSettingId.ShellIntegrationSuggestEnabled),
},
windowsEnableConpty: this._configHelper.config.windowsEnableConpty && !isScreenReaderModeEnabled,
windowsEnableConpty: this._configHelper.config.windowsEnableConpty,
environmentVariableCollections: this._extEnvironmentVariableCollection?.collections ? serializeEnvironmentVariableCollections(this._extEnvironmentVariableCollection.collections) : undefined
};
try {
Expand Down Expand Up @@ -320,7 +317,7 @@ export class TerminalProcessManager extends Disposable implements ITerminalProce
}
}
if (!newProcess) {
newProcess = await this._launchLocalProcess(backend, shellLaunchConfig, cols, rows, this.userHome, isScreenReaderModeEnabled, variableResolver);
newProcess = await this._launchLocalProcess(backend, shellLaunchConfig, cols, rows, this.userHome, variableResolver);
}
if (!this._isDisposed) {
this._setupPtyHostListeners(backend);
Expand Down Expand Up @@ -392,7 +389,7 @@ export class TerminalProcessManager extends Disposable implements ITerminalProce
return undefined;
}

async relaunch(shellLaunchConfig: IShellLaunchConfig, cols: number, rows: number, isScreenReaderModeEnabled: boolean, reset: boolean): Promise<ITerminalLaunchError | undefined> {
async relaunch(shellLaunchConfig: IShellLaunchConfig, cols: number, rows: number, reset: boolean): Promise<ITerminalLaunchError | undefined> {
this.ptyProcessReady = this._createPtyProcessReadyPromise();
this._logService.trace(`Relaunching terminal instance ${this._instanceId}`);

Expand All @@ -406,7 +403,7 @@ export class TerminalProcessManager extends Disposable implements ITerminalProce
// triggered
this._hasWrittenData = false;

return this.createProcess(shellLaunchConfig, cols, rows, isScreenReaderModeEnabled, reset);
return this.createProcess(shellLaunchConfig, cols, rows, reset);
}

// Fetch any extension environment additions and apply them
Expand Down Expand Up @@ -448,7 +445,6 @@ export class TerminalProcessManager extends Disposable implements ITerminalProce
cols: number,
rows: number,
userHome: string | undefined,
isScreenReaderModeEnabled: boolean,
variableResolver: terminalEnvironment.VariableResolver | undefined
): Promise<ITerminalChildProcess> {
await this._terminalProfileResolverService.resolveShellLaunchConfig(shellLaunchConfig, {
Expand All @@ -473,7 +469,7 @@ export class TerminalProcessManager extends Disposable implements ITerminalProce
enabled: this._configurationService.getValue(TerminalSettingId.ShellIntegrationEnabled),
suggestEnabled: this._configurationService.getValue(TerminalSettingId.ShellIntegrationSuggestEnabled),
},
windowsEnableConpty: this._configHelper.config.windowsEnableConpty && !isScreenReaderModeEnabled,
windowsEnableConpty: this._configHelper.config.windowsEnableConpty,
environmentVariableCollections: this._extEnvironmentVariableCollection ? serializeEnvironmentVariableCollections(this._extEnvironmentVariableCollection.collections) : undefined
};
const shouldPersist = ((this._configurationService.getValue(TaskSettingId.Reconnection) && shellLaunchConfig.reconnectionProperties) || !shellLaunchConfig.isFeatureTerminal) && this._configHelper.config.enablePersistentSessions && !shellLaunchConfig.isTransient;
Expand Down Expand Up @@ -521,7 +517,7 @@ export class TerminalProcessManager extends Disposable implements ITerminalProce
// using the previous shellLaunchConfig
const message = localize('ptyHostRelaunch', "Restarting the terminal because the connection to the shell process was lost...");
this._onProcessData.fire({ data: formatMessageForTerminal(message, { loudFormatting: true }), trackCommit: false });
await this.relaunch(this._shellLaunchConfig, this._dimensions.cols, this._dimensions.rows, this._isScreenReaderModeEnabled, false);
await this.relaunch(this._shellLaunchConfig, this._dimensions.cols, this._dimensions.rows, false);
}
}
}));
Expand Down
4 changes: 2 additions & 2 deletions src/vs/workbench/contrib/terminal/common/terminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,8 +418,8 @@ export interface ITerminalProcessManager extends IDisposable {

dispose(immediate?: boolean): void;
detachFromProcess(forcePersist?: boolean): Promise<void>;
createProcess(shellLaunchConfig: IShellLaunchConfig, cols: number, rows: number, isScreenReaderModeEnabled: boolean): Promise<ITerminalLaunchError | undefined>;
relaunch(shellLaunchConfig: IShellLaunchConfig, cols: number, rows: number, isScreenReaderModeEnabled: boolean, reset: boolean): Promise<ITerminalLaunchError | undefined>;
createProcess(shellLaunchConfig: IShellLaunchConfig, cols: number, rows: number): Promise<ITerminalLaunchError | undefined>;
relaunch(shellLaunchConfig: IShellLaunchConfig, cols: number, rows: number, reset: boolean): Promise<ITerminalLaunchError | undefined>;
write(data: string): Promise<void>;
setDimensions(cols: number, rows: number): Promise<void>;
setDimensions(cols: number, rows: number, sync: false): Promise<void>;
Expand Down