Skip to content

Commit 1083123

Browse files
committed
Disable conpty in terminal when accessibility mode is on
Fixes microsoft#76043
1 parent 8ac732d commit 1083123

4 files changed

Lines changed: 13 additions & 6 deletions

File tree

src/vs/workbench/api/node/extHostTerminalService.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,7 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
538538
// Fork the process and listen for messages
539539
this._logService.debug(`Terminal process launching on ext host`, shellLaunchConfig, initialCwd, cols, rows, env);
540540
// TODO: Support conpty on remote, it doesn't seem to work for some reason?
541+
// TODO: When conpty is enabled, only enable it when accessibilityMode is off
541542
const enableConpty = false; //terminalConfig.get('windowsEnableConpty') as boolean;
542543
const p = new TerminalProcess(shellLaunchConfig, initialCwd, cols, rows, env, enableConpty, this._logService);
543544
p.onProcessReady((e: { pid: number, cwd: string }) => this._proxy.$sendProcessReady(id, e.pid, e.cwd));

src/vs/workbench/contrib/terminal/browser/terminalInstance.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,7 @@ export class TerminalInstance implements ITerminalInstance {
970970
// Create the process asynchronously to allow the terminal's container
971971
// to be created so dimensions are accurate
972972
setTimeout(() => {
973-
this._processManager!.createProcess(this._shellLaunchConfig, this._cols, this._rows);
973+
this._processManager!.createProcess(this._shellLaunchConfig, this._cols, this._rows, this._isScreenReaderOptimized());
974974
}, 0);
975975
}
976976

src/vs/workbench/contrib/terminal/browser/terminalProcessManager.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ export class TerminalProcessManager implements ITerminalProcessManager {
100100
public async createProcess(
101101
shellLaunchConfig: IShellLaunchConfig,
102102
cols: number,
103-
rows: number
103+
rows: number,
104+
isScreenReaderModeEnabled: boolean
104105
): Promise<void> {
105106
const forceExtHostProcess = (this._configHelper.config as any).extHostProcess;
106107
if (shellLaunchConfig.cwd && typeof shellLaunchConfig.cwd === 'object') {
@@ -127,7 +128,7 @@ export class TerminalProcessManager implements ITerminalProcessManager {
127128
const activeWorkspaceRootUri = this._historyService.getLastActiveWorkspaceRoot();
128129
this._process = this._instantiationService.createInstance(TerminalProcessExtHostProxy, this._terminalId, shellLaunchConfig, activeWorkspaceRootUri, cols, rows, this._configHelper);
129130
} else {
130-
this._process = await this._launchProcess(shellLaunchConfig, cols, rows);
131+
this._process = await this._launchProcess(shellLaunchConfig, cols, rows, isScreenReaderModeEnabled);
131132
}
132133
this.processState = ProcessState.LAUNCHING;
133134

@@ -161,7 +162,12 @@ export class TerminalProcessManager implements ITerminalProcessManager {
161162
}, LAUNCHING_DURATION);
162163
}
163164

164-
private async _launchProcess(shellLaunchConfig: IShellLaunchConfig, cols: number, rows: number): Promise<ITerminalChildProcess> {
165+
private async _launchProcess(
166+
shellLaunchConfig: IShellLaunchConfig,
167+
cols: number,
168+
rows: number,
169+
isScreenReaderModeEnabled: boolean
170+
): Promise<ITerminalChildProcess> {
165171
if (!shellLaunchConfig.executable) {
166172
const defaultConfig = await this._terminalInstanceService.getDefaultShellAndArgs();
167173
shellLaunchConfig.executable = defaultConfig.shell;
@@ -178,7 +184,7 @@ export class TerminalProcessManager implements ITerminalProcessManager {
178184
const baseEnv = this._configHelper.config.inheritEnv ? process.env as platform.IProcessEnvironment : await this._terminalInstanceService.getMainProcessParentEnv();
179185
const env = terminalEnvironment.createTerminalEnvironment(shellLaunchConfig, lastActiveWorkspace, envFromConfigValue, this._configurationResolverService, isWorkspaceShellAllowed, this._productService.version, this._configHelper.config.setLocaleVariables, baseEnv);
180186

181-
const useConpty = this._configHelper.config.windowsEnableConpty;
187+
const useConpty = this._configHelper.config.windowsEnableConpty && !isScreenReaderModeEnabled;
182188
return this._terminalInstanceService.createTerminalProcess(shellLaunchConfig, initialCwd, cols, rows, env, useConpty);
183189
}
184190

src/vs/workbench/contrib/terminal/common/terminal.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ export interface ITerminalProcessManager extends IDisposable {
701701
readonly onProcessExit: Event<number>;
702702

703703
dispose(immediate?: boolean): void;
704-
createProcess(shellLaunchConfig: IShellLaunchConfig, cols: number, rows: number): Promise<void>;
704+
createProcess(shellLaunchConfig: IShellLaunchConfig, cols: number, rows: number, isScreenReaderModeEnabled: boolean): Promise<void>;
705705
write(data: string): void;
706706
setDimensions(cols: number, rows: number): void;
707707

0 commit comments

Comments
 (0)