Add rendererType terminal setting

This commit is contained in:
Daniel Imms
2018-05-16 10:17:17 -07:00
parent 048f609ab0
commit 2b251d6e5e
3 changed files with 17 additions and 7 deletions

View File

@@ -63,6 +63,7 @@ export interface ITerminalConfiguration {
windows: string[];
};
macOptionIsMeta: boolean;
rendererType: 'auto' | 'canvas' | 'dom';
rightClickBehavior: 'default' | 'copyPaste' | 'selectWord';
cursorBlinking: boolean;
cursorStyle: string;

View File

@@ -182,11 +182,17 @@ configurationRegistry.registerConfiguration({
'type': 'boolean',
'default': platform.isMacintosh
},
'terminal.integrated.rendererType': {
'type': 'string',
'enum': ['auto', 'canvas', 'dom'],
default: 'auto',
description: nls.localize('terminal.integrated.rendererType', "Controls how the terminal is rendered, the options are \"canvas\" for the standard canvas renderer, \"dom\" for the fallback DOM-based renderer or \"auto\" which lets VS Code guess which will be best. This setting needs VS Code to reload in order to take effect for new terminals.")
},
'terminal.integrated.rightClickBehavior': {
'type': 'string',
'enum': ['default', 'copyPaste', 'selectWord'],
default: platform.isMacintosh ? 'selectWord' : platform.isWindows ? 'copyPaste' : 'default',
description: nls.localize('terminal.integrated.rightClickBehavior', "Controls how terminal reacts to right click, possibilities are 'default', 'copyPaste', and 'selectWord'. 'default' will show the context menu, 'copyPaste' will copy when there is a selection otherwise paste, 'selectWord' will select the word under the cursor and show the context menu.")
description: nls.localize('terminal.integrated.rightClickBehavior', "Controls how terminal reacts to right click, possibilities are \"default\", \"copyPaste\", and \"selectWord\". \"default\" will show the context menu, \"copyPaste\" will copy when there is a selection otherwise paste, \"selectWord\" will select the word under the cursor and show the context menu.")
},
'terminal.integrated.cwd': {
'description': nls.localize('terminal.integrated.cwd', "An explicit start path where the terminal will be launched, this is used as the current working directory (cwd) for the shell process. This may be particularly useful in workspace settings if the root directory is not a convenient cwd."),

View File

@@ -249,19 +249,22 @@ export class TerminalInstance implements ITerminalInstance {
}
const accessibilitySupport = this._configurationService.getValue<IEditorOptions>('editor').accessibilitySupport;
const font = this._configHelper.getFont(undefined, true);
const config = this._configHelper.config;
this._xterm = new Terminal({
scrollback: this._configHelper.config.scrollback,
scrollback: config.scrollback,
theme: this._getXtermTheme(),
fontFamily: font.fontFamily,
fontWeight: this._configHelper.config.fontWeight,
fontWeightBold: this._configHelper.config.fontWeightBold,
fontWeight: config.fontWeight,
fontWeightBold: config.fontWeightBold,
fontSize: font.fontSize,
letterSpacing: font.letterSpacing,
lineHeight: font.lineHeight,
bellStyle: this._configHelper.config.enableBell ? 'sound' : 'none',
bellStyle: config.enableBell ? 'sound' : 'none',
screenReaderMode: accessibilitySupport === 'on',
macOptionIsMeta: this._configHelper.config.macOptionIsMeta,
rightClickSelectsWord: this._configHelper.config.rightClickBehavior === 'selectWord'
macOptionIsMeta: config.macOptionIsMeta,
rightClickSelectsWord: config.rightClickBehavior === 'selectWord',
// TODO: Guess whether to use canvas or dom better
rendererType: config.rendererType === 'auto' ? 'canvas' : config.rendererType
});
if (this._shellLaunchConfig.initialText) {
this._xterm.writeln(this._shellLaunchConfig.initialText);