Change:
} async sendText(text: string, addNewLine: boolean): Promise<void> { <ins> // Apply bracketed paste sequences if the terminal has the mode enabled, this will prevent // the text from triggering keybindings https://github.com/microsoft/vscode/issues/153592 if (this.xterm?.raw.modes.bracketedPasteMode) { text = `x1b[200~${text}x1b[201~`; } </ins> // Normalize line endings to 'enter' press. text = text.replace(/r?n/g, 'r'); <del> if (addNewLine && text.substr(text.length - 1) !== 'r') { </del> <ins> if (addNewLine && text[text.length - 1] !== 'r') { </ins> text += 'r'; }

Discussion:
<!-- Do Not Delete This! featurerequesttemplate --<!-- Please read our Rules of Conduct: --<!-- Please search existing issues to avoid creating duplicates. --<!-- Describe the feature you'd like. --Several shells (, , ) include vi mode keybindings. It's common for users to rebind vi escape to something like , , or . When interfacing with the shell, VS Code behaves as if it were a user typing keys, which may trigger vi escape if file names or other text input to the shell contains the escape sequence. To show the problematic behavior (assuming the shell is ): Include these lines in your In VS Code, try to run a Python file named . VS Code enters this file name into the shell, which triggers the escape sequence and causes the shell to interpret following the as vi normal mode commands. If VS Code input text to the shell with bracketed paste, this would not happen.
Not sure if this is related, but I use Spectacle to move and resize my windows. It used to work perfectly, but now, since today's update, I cannot use my shortcut to resize my VSCode instance. The shortcuts I used were control+option+command+(left/right/down/up) to move and resize, and option+command+f to toggle fullscreen(not fullscreen but resized as fullscreen). These shortcuts do nothing in VSCode and are not triggered anymore through Spectacle
Can you clarify how you're running the file? I think I understand the problem, sending text to the terminal via extension API or run active file, etc. are triggering the keybinding but wrapping them in bracketed paste would fix it. It should be safe to wrap in the bracketed paste sequences provided the mode is enabled in the terminal. that sounds like a different issue, maybe related to Electron.
Thank you, I'm gonna post this as a new issue.
I'm running the file using Run -Start Debugging, selecting 'Python File' as the debug configuration. VS Code then enters this into the shell: The file is supposed to be called but my shell sees (my escape sequence) and then stops at .

Thanks for confirming, we should be able to include the fix in 1.70 (too late for 1.69 unfortunately)
This caused a regression unfortunately so reopening The actual fix is more involved than I thought, we will need to be able to pass in a flag for whether to wrap in bracketed paste mode into the sendSequence command, internal API, extension API. An extension could wrap what it's sending in bracketed paste mode now but that won't work when the shell isn't in bracketed paste mode and the extension is not able to determine that.
We closed this issue because we in the foreseeable future. If you disagree and feel that this issue is crucial: we are happy to listen and to reconsider. If you wonder what we are up to, please see our and . Thanks for your understanding, and happy coding!