Use bracketed paste for multiline executed terminal text#302526
Draft
jcansdale wants to merge 1 commit intomicrosoft:mainfrom
Draft
Use bracketed paste for multiline executed terminal text#302526jcansdale wants to merge 1 commit intomicrosoft:mainfrom
jcansdale wants to merge 1 commit intomicrosoft:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates TerminalInstance.sendText to automatically wrap multiline text in bracketed paste sequences when the terminal has bracketed paste mode enabled, and adds a unit test to cover the multiline executed-text behavior.
Changes:
- Automatically enable bracketed paste wrapping when
sendTextreceives multiline text and xterm reports bracketed paste mode is enabled. - Preserve existing behavior for callers explicitly requesting bracketed paste mode.
- Add a unit test validating multiline executed text is sent wrapped 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 auto-apply bracketed paste for multiline text when supported/enabled. |
| src/vs/workbench/contrib/terminal/test/browser/terminalInstance.test.ts | Adds a regression/unit test for multiline executed text using bracketed paste, and refactors instance creation into a helper. |
| terminalInstance = store.add(instantiationService.createInstance(TerminalInstance, terminalShellTypeContextKey, {})); | ||
| // //Wait for the teminalInstance._xtermReadyPromise to resolve | ||
| const instance = store.add(instantiationService.createInstance(TerminalInstance, terminalShellTypeContextKey, {})); | ||
| await new Promise(resolve => setTimeout(resolve, 100)); |
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.
Summary
Why This Is Required
Executed multiline text currently goes through
sendText(..., true)without bracketed paste unless a caller explicitly opts in. That means the terminal receives the payload as raw typed input instead of a pasted block.For single-line text that is fine, but for multiline commands it changes shell behavior. Embedded newlines are handled like Enter presses, readline and keybindings can interfere, and quoting can break before the final execute is sent. Shell integration and chat terminal execution both rely on this path, so the bug shows up in real command execution.
Repro
Expected result
Before this change, repeated runs of the same multiline payload in a live terminal session could behave inconsistently. During debugging this showed up as wrong counts, replayed stale fragments, or a continuation prompt instead of a clean result.