From 848157095a77ac6a5baac0d0aa6ffecf4f65920a Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Tue, 14 Mar 2017 14:57:40 -0700 Subject: [PATCH] Support IShellLaunchConfig.initialText Fixes #22377 --- src/vs/workbench/parts/terminal/common/terminal.ts | 7 +++++++ .../parts/terminal/electron-browser/terminalInstance.ts | 3 +++ 2 files changed, 10 insertions(+) diff --git a/src/vs/workbench/parts/terminal/common/terminal.ts b/src/vs/workbench/parts/terminal/common/terminal.ts index 1bffc84c62c..e46517d157f 100644 --- a/src/vs/workbench/parts/terminal/common/terminal.ts +++ b/src/vs/workbench/parts/terminal/common/terminal.ts @@ -102,6 +102,13 @@ export interface IShellLaunchConfig { ignoreConfigurationCwd?: boolean; /** Whether to wait for a key press before closing the terminal. */ waitOnExit?: boolean; + /** + * A string including ANSI escape sequences that will be written to the terminal emulator + * _before_ the terminal process has launched, a trailing \n is added at the end of the string. + * This allows for example the terminal instance to display a styled message as the first line + * of the terminal. Use \x1b over \033 or \e for the escape control character. + */ + initialText?: string; } export interface ITerminalService { diff --git a/src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts b/src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts index 12e5e03e5ee..19c450b6744 100644 --- a/src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts +++ b/src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts @@ -192,6 +192,9 @@ export class TerminalInstance implements ITerminalInstance { this._xterm = xterm({ scrollback: this._configHelper.config.scrollback }); + if (this._shellLaunchConfig.initialText) { + this._xterm.writeln(this._shellLaunchConfig.initialText); + } this._process.on('message', (message) => this._sendPtyDataToXterm(message)); this._xterm.on('data', (data) => { if (this._process) { -- GitLab