Skip to content

Commit 099759c

Browse files
committed
Apply bracketed paste mode on text send to the terminal
Fixes microsoft#153592
1 parent 1095364 commit 099759c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1460,9 +1460,15 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
14601460
}
14611461

14621462
async sendText(text: string, addNewLine: boolean): Promise<void> {
1463+
// Apply bracketed paste sequences if the terminal has the mode enabled, this will prevent
1464+
// the text from triggering keybindings https://github.com/microsoft/vscode/issues/153592
1465+
if (this.xterm?.raw.modes.bracketedPasteMode) {
1466+
text = `\x1b[200~${text}\x1b[201~`;
1467+
}
1468+
14631469
// Normalize line endings to 'enter' press.
14641470
text = text.replace(/\r?\n/g, '\r');
1465-
if (addNewLine && text.substr(text.length - 1) !== '\r') {
1471+
if (addNewLine && text.at(-1) !== '\r') {
14661472
text += '\r';
14671473
}
14681474

0 commit comments

Comments
 (0)