diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 38bdf5534054ba4aeaea38af52359291c81dcd6f..0252fc587665ef9c0bbed46e77accbdcd42479ce 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -432,7 +432,7 @@ "xterm": { "version": "2.2.3", "from": "git+https://github.com/Tyriar/xterm.js.git#vscode-release/1.9", - "resolved": "git+https://github.com/Tyriar/xterm.js.git#f30504b908ff9c9e1917add36353da66b176e08a" + "resolved": "git+https://github.com/Tyriar/xterm.js.git#27f7052106825b7e2e89358bed84bb1a285d7aaf" }, "yauzl": { "version": "2.3.1", diff --git a/src/vs/workbench/parts/terminal/common/terminal.ts b/src/vs/workbench/parts/terminal/common/terminal.ts index 90d0d991f2911b228b9667f4e0ae9fcc3f291361..a1b2069f566d059b754f7cf9407d6d1c3d9e6106 100644 --- a/src/vs/workbench/parts/terminal/common/terminal.ts +++ b/src/vs/workbench/parts/terminal/common/terminal.ts @@ -58,7 +58,8 @@ export interface ITerminalConfiguration { setLocaleVariables: boolean, scrollback: number, commandsToSkipShell: string[], - cwd: string + cwd: string, + flowControl: boolean } }; } @@ -67,6 +68,7 @@ export interface ITerminalConfigHelper { getTheme(baseThemeId: string): string[]; getFont(): ITerminalFont; getFontLigaturesEnabled(): boolean; + getFlowControl(): boolean; getCursorBlink(): boolean; getRightClickCopyPaste(): boolean; getCommandsToSkipShell(): string[]; diff --git a/src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts b/src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts index 1bf03a4b9e27483ecc00ec93d1e4d30b2fa87c01..06e02fe29006b4fefb72fc7cf49f8af1107d849f 100644 --- a/src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts +++ b/src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts @@ -12,7 +12,7 @@ import nls = require('vs/nls'); import { Extensions, IConfigurationRegistry } from 'vs/platform/configuration/common/configurationRegistry'; import { GlobalQuickOpenAction } from 'vs/workbench/browser/parts/quickopen/quickopen.contribution'; import { ITerminalService, KEYBINDING_CONTEXT_TERMINAL_FOCUS, KEYBINDING_CONTEXT_TERMINAL_TEXT_SELECTED, TERMINAL_PANEL_ID, TERMINAL_DEFAULT_RIGHT_CLICK_COPY_PASTE, TerminalCursorStyle } from 'vs/workbench/parts/terminal/common/terminal'; -import { TERMINAL_DEFAULT_SHELL_LINUX, TERMINAL_DEFAULT_SHELL_OSX, TERMINAL_DEFAULT_SHELL_WINDOWS } from 'vs/workbench/parts/terminal/electron-browser/terminal'; +import { TERMINAL_DEFAULT_SHELL_LINUX, TERMINAL_DEFAULT_SHELL_OSX, TERMINAL_DEFAULT_SHELL_WINDOWS, TERMINAL_DEFAULT_FLOW_CONTROL } from 'vs/workbench/parts/terminal/electron-browser/terminal'; import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actionRegistry'; import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; @@ -119,6 +119,11 @@ configurationRegistry.registerConfiguration({ 'type': 'number', 'default': 1000 }, + 'terminal.integrated.flowControl': { + 'description': nls.localize('terminal.integrated.flowControl', "Controls the whether the terminal emulator will use flow control in order to catch up with the shell process, the main effect of this is that ^C and other signals should be much more responsive when commands give lots of output. You should this disabled if you have custom ^S or ^Q keybindings that override the XOFF and XON signals used."), + 'type': 'boolean', + 'default': TERMINAL_DEFAULT_FLOW_CONTROL + }, 'terminal.integrated.setLocaleVariables': { 'description': nls.localize('terminal.integrated.setLocaleVariables', "Controls whether locale variables are set at startup of the terminal, this defaults to true on OS X, false on other platforms."), 'type': 'boolean', diff --git a/src/vs/workbench/parts/terminal/electron-browser/terminal.ts b/src/vs/workbench/parts/terminal/electron-browser/terminal.ts index e3d6eb37951b57144d12b8a9b28958e900ee52a1..1e1fff02af0dac9e34b10f5784e33818328726f6 100644 --- a/src/vs/workbench/parts/terminal/electron-browser/terminal.ts +++ b/src/vs/workbench/parts/terminal/electron-browser/terminal.ts @@ -5,6 +5,7 @@ 'use strict'; import * as os from 'os'; +import * as path from 'path'; import * as cp from 'child_process'; import platform = require('vs/base/common/platform'); import processes = require('vs/base/node/processes'); @@ -18,6 +19,11 @@ const powerShellPath = `${process.env.windir}\\${is64BitWindows ? 'Sysnative' : export const TERMINAL_DEFAULT_SHELL_WINDOWS = isAtLeastWindows10 ? powerShellPath : processes.getWindowsShell(); +// Terminal flow control is disabled if the shell is zsh since the popular oh-my-zsh configuration +// overrides the ^S and ^Q keybindings which are used for flow control. +// TODO: This should check if ~/.oh-my-zsh exists as well +export const TERMINAL_DEFAULT_FLOW_CONTROL = path.basename(process.env.SHELL) !== 'zsh'; + export interface ITerminalProcessFactory { create(env: { [key: string]: string }): cp.ChildProcess; } diff --git a/src/vs/workbench/parts/terminal/electron-browser/terminalConfigHelper.ts b/src/vs/workbench/parts/terminal/electron-browser/terminalConfigHelper.ts index c62cdccdcf2aeb73ba5dc62b55fbe00bc30a94b4..f9ee66c5a5037ee4b63510e6a38ad7d53a11c901 100644 --- a/src/vs/workbench/parts/terminal/electron-browser/terminalConfigHelper.ts +++ b/src/vs/workbench/parts/terminal/electron-browser/terminalConfigHelper.ts @@ -137,6 +137,11 @@ export class TerminalConfigHelper implements ITerminalConfigHelper { return terminalConfig.terminal.integrated.fontLigatures; } + public getFlowControl(): boolean { + const terminalConfig = this._configurationService.getConfiguration(); + return terminalConfig.terminal.integrated.flowControl; + } + public getCursorBlink(): boolean { const terminalConfig = this._configurationService.getConfiguration(); return terminalConfig.terminal.integrated.cursorBlinking; diff --git a/src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts b/src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts index e1b7b7ce6be5f53caa46e20da4624332b5eebc6e..9e30d9bafe309c95820af3aeb3f17996ccb01d9e 100644 --- a/src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts +++ b/src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts @@ -543,12 +543,19 @@ export class TerminalInstance implements ITerminalInstance { } public updateConfig(): void { + this._setFlowControl(this._configHelper.getFlowControl()); this._setCursorBlink(this._configHelper.getCursorBlink()); this._setCursorStyle(this._configHelper.getCursorStyle()); this._setCommandsToSkipShell(this._configHelper.getCommandsToSkipShell()); this._setScrollback(this._configHelper.getScrollback()); } + private _setFlowControl(flowControl: boolean): void { + if (this._xterm && this._xterm.getOption('useFlowControl') !== flowControl) { + this._xterm.setOption('useFlowControl', flowControl); + } + } + private _setCursorBlink(blink: boolean): void { if (this._xterm && this._xterm.getOption('cursorBlink') !== blink) { this._xterm.setOption('cursorBlink', blink);