Repository navigation
fix(mobile): shell Paste inserts a multi-line block as one bracketed paste - #600
Merged
Merged
Conversation
…paste The shell accessory bar's Paste overlay sent its text raw and then an Enter (`app.sendInput(text)` + a delayed `\r`), so every newline in a multi-line paste reached the shell as Enter and each line ran on its own the moment it arrived, followed by one more Enter. Send it the way a terminal paste does instead: one write wrapped in ESC[200~ ... ESC[201~ with newlines as CR, through the same path Compose already uses (its bracketed write is extracted into `_sendBracketedPaste`, unchanged for Compose). Paste never presses Enter: the block lands at the prompt for the user to review and run. The overlay is only reached for shell sessions (the shell bar's Paste button, and Compose redirecting a shell), so agent sessions are unaffected. Also: a paste over the input-frame budget is refused with a toast and keeps its text for trimming (the raw path could exceed the WS frame limit), and the paste goes to the session the overlay was opened for, not whichever tab is active at Send. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…pened for The Paste dialog's image branch called _uploadAndInsertImages() without a session, so it fell back to the active session at pick time: after a tab switch with the dialog open, the image went to the other tab, while the text Send already used the session captured at open. Also corrects the comments around the shared bracketed write: the size refusal now lives in _sendBracketedPaste(), the budget covers the shell Paste too, and a shell without bracketed paste (dash, bash before 5.1) gets the markers stripped by tmux, so every line but the last still runs there. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Author
|
One follow-up commit on top, from a second pass over this PR:
The description now also says that a one-line paste waits for Enter. |
Ark0N
pushed a commit
that referenced
this pull request
Oct 13, 2026
…600 merge-time fix) _sendBracketedPaste wrapped the text as is, so clipboard text carrying the end marker (a pastejacking page can write one) closed the bracket early and the rest was typed as keys, its CR running a command before review. The paste markers inside the text are now dropped first; this also hardens the Compose path, which shares the helper. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Owner
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.
On a phone, the shell accessory bar's Paste overlay sent its text raw and then an Enter (
app.sendInput(text)+ a delayed\r). Every newline in a multi-line paste reached the shell as Enter, so each line ran as soon as it arrived, followed by one more Enter.ESC[200~ … ESC[201~with newlines as CR, through the same path Compose already uses (its bracketed write is extracted into_sendBracketedPaste, unchanged for Compose). Paste never presses Enter: the block lands at the prompt for the user to review and run. This applies to a single-line paste too: a pasted one-liner now waits for Enter instead of running.The overlay is only reached for shell sessions (the shell bar's Paste button, and Compose redirecting a shell), so agent sessions are unaffected.
Testing: new cases in
test/mobile-prompt-composer.test.ts; typecheck, lint, frontend syntax, format check and the full suite green on this branch. Checked by hand on a phone against my own deployment: a multi-line paste lands at the prompt as one block and runs only on Enter. Checked against tmux 3.5a with a client writing the frame into bash, zsh, dash andcat -v: bash and zsh take the block as one edit, dash andcatshow no marker bytes.