fix(terminal): avoid auto bracketed paste for non-executed control sequences#303666
Open
kh4f wants to merge 2 commits intomicrosoft:mainfrom
Open
fix(terminal): avoid auto bracketed paste for non-executed control sequences#303666kh4f wants to merge 2 commits intomicrosoft:mainfrom
kh4f wants to merge 2 commits intomicrosoft:mainfrom
Conversation
…quences PR microsoft#302526 introduced automatic bracketed paste for any text containing `\r` or `\n`. This unintentionally changed the behavior of `sendText(text, false)` for control sequences such as `\u000D`, which could previously be sent as raw keystrokes via the `workbench.action.terminal.sendSequence` command to simulate Enter. This patch restores the original behavior by applying automatic bracketed paste only when: - explicitly requested via `bracketedPasteMode`, or - the text is multiline *and* `shouldExecute` is true This preserves the multiline execution fix while keeping non-executed control sequences raw. A regression test is included to verify that `sendText('\r', false)` sends a plain `\r` to the pty instead of wrapping it in bracketed paste. Fixes microsoft#303665
Contributor
There was a problem hiding this comment.
Pull request overview
This PR restores the pre-#302526 behavior for TerminalInstance.sendText(text, false) when sending control sequences (eg \r) by limiting automatic bracketed paste to explicitly requested cases or executed multiline input, preventing sendSequence regressions while keeping the multiline-execution fix.
Changes:
- Restrict automatic bracketed paste wrapping to
bracketedPasteMode === trueor(shouldExecute && text contains newline chars), when bracketed paste is enabled in xterm. - Add a regression test ensuring
sendText('\r', false)writes a raw\rrather than wrapping it in bracketed paste sequences.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/vs/workbench/contrib/terminal/browser/terminalInstance.ts | Adjusts sendText to avoid bracketed paste wrapping for non-executed control sequences while preserving executed multiline behavior. |
| src/vs/workbench/contrib/terminal/test/browser/terminalInstance.test.ts | Adds regression coverage verifying raw \r is sent when shouldExecute is false. |
src/vs/workbench/contrib/terminal/test/browser/terminalInstance.test.ts
Outdated
Show resolved
Hide resolved
Author
|
@microsoft-github-policy-service agree |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR #302526 introduced automatic bracketed paste for any text containing
\ror\n. This unintentionally changed the behavior ofsendText(text, false)for control sequences such as\u000D, which could previously be sent as raw keystrokes via theworkbench.action.terminal.sendSequencecommand to simulate Enter.This patch restores the original behavior by applying automatic bracketed paste only when:
bracketedPasteMode, orshouldExecuteis trueThis preserves the multiline execution fix while keeping non-executed control sequences raw.
A regression test is included to verify that
sendText('\r', false)sends a plain\rto the pty instead of wrapping it in bracketed paste.Fixes #303665