提交 27be5beb 编写于 作者: D Daniel Imms

Support macOptionIsMeta

Fixes #11314
上级 8e7ca11a
......@@ -67,6 +67,11 @@ declare module 'vscode-xterm' {
*/
lineHeight?: number;
/**
* Whether to treat option as the meta key.
*/
macOptionIsMeta?: boolean;
/**
* The number of rows in the terminal.
*/
......@@ -422,7 +427,7 @@ declare module 'vscode-xterm' {
* Retrieves an option's value from the terminal.
* @param key The option key.
*/
getOption(key: 'cancelEvents' | 'convertEol' | 'cursorBlink' | 'debug' | 'disableStdin' | 'enableBold' | 'popOnBell' | 'screenKeys' | 'useFlowControl' | 'visualBell'): boolean;
getOption(key: 'cancelEvents' | 'convertEol' | 'cursorBlink' | 'debug' | 'disableStdin' | 'enableBold' | 'macOptionIsMeta' | 'popOnBell' | 'screenKeys' | 'useFlowControl' | 'visualBell'): boolean;
/**
* Retrieves an option's value from the terminal.
* @param key The option key.
......@@ -467,7 +472,7 @@ declare module 'vscode-xterm' {
* @param key The option key.
* @param value The option value.
*/
setOption(key: 'cancelEvents' | 'convertEol' | 'cursorBlink' | 'debug' | 'disableStdin' | 'enableBold' | 'popOnBell' | 'screenKeys' | 'useFlowControl' | 'visualBell', value: boolean): void;
setOption(key: 'cancelEvents' | 'convertEol' | 'cursorBlink' | 'debug' | 'disableStdin' | 'enableBold' | 'macOptionIsMeta' | 'popOnBell' | 'screenKeys' | 'useFlowControl' | 'visualBell', value: boolean): void;
/**
* Sets an option on the terminal.
* @param key The option key.
......
......@@ -61,6 +61,7 @@ export interface ITerminalConfiguration {
windows: string[];
};
enableBold: boolean;
macOptionIsMeta: boolean;
rightClickCopyPaste: boolean;
cursorBlinking: boolean;
cursorStyle: string;
......
......@@ -115,6 +115,11 @@ configurationRegistry.registerConfiguration({
},
'default': []
},
'terminal.integrated.macOptionIsMeta': {
'description': nls.localize('terminal.integrated.macOptionIsMeta', "Treat the option key as the meta key in the terminal on macOS."),
'type': 'boolean',
'default': false
},
'terminal.integrated.rightClickCopyPaste': {
'description': nls.localize('terminal.integrated.rightClickCopyPaste', "When set, this will prevent the context menu from appearing when right clicking within the terminal, instead it will copy when there is a selection and paste when there is no selection."),
'type': 'boolean',
......
......@@ -282,7 +282,8 @@ export class TerminalInstance implements ITerminalInstance {
lineHeight: font.lineHeight,
enableBold: this._configHelper.config.enableBold,
bellStyle: this._configHelper.config.enableBell ? 'sound' : 'none',
screenReaderMode: accessibilitySupport === 'on'
screenReaderMode: accessibilitySupport === 'on',
macOptionIsMeta: this._configHelper.config.macOptionIsMeta
});
if (this._shellLaunchConfig.initialText) {
this._xterm.writeln(this._shellLaunchConfig.initialText);
......@@ -981,6 +982,7 @@ export class TerminalInstance implements ITerminalInstance {
this._setCommandsToSkipShell(this._configHelper.config.commandsToSkipShell);
this._setScrollback(this._configHelper.config.scrollback);
this._setEnableBell(this._configHelper.config.enableBell);
this._setMacOptionIsMeta(this._configHelper.config.macOptionIsMeta);
}
public updateAccessibilitySupport(): void {
......@@ -1013,6 +1015,12 @@ export class TerminalInstance implements ITerminalInstance {
}
}
private _setMacOptionIsMeta(value: boolean): void {
if (this._xterm && this._xterm.getOption('macOptionIsMeta') !== value) {
this._xterm.setOption('macOptionIsMeta', value);
}
}
private _setEnableBell(isEnabled: boolean): void {
if (this._xterm) {
if (this._xterm.getOption('bellStyle') === 'sound') {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册