Compose a pasted CR/LF instead of submitting on it - #347
Merged
TheGreatAxios merged 2 commits intoAug 7, 2026
Merged
Conversation
TheGreatAxios
force-pushed
the
cl-5541-pasting-into-the-prompt-is-broken
branch
from
August 7, 2026 04:36
5354401 to
f22ee89
Compare
A terminal that never negotiates bracketed paste (DEC 2004) delivers a multi-line paste as ordinary keystrokes, carriage returns included, and a bare CR is the same "return" that sends the message. Pasting three lines was sending three separate messages instead of composing one. An unmodified Enter that lands in a keystroke burst right after a plain character is paste-carried, not a deliberate submit, so it now becomes a newline; a CRLF pair collapses to one newline instead of two. A real Ctrl+J-then-Enter (insert a line, then send) still sends, since Ctrl+J never counts as "a printable character" preceding it.
The guard from the previous commit ran on every keystroke regardless of whether the terminal actually needed it. A terminal proves it negotiates DEC 2004 the first time it fires a real paste event -- from then on every paste arrives as that one event, never as raw keystrokes, so the fallback has nothing left to guard against. Retire it for the session once that happens instead of re-running it forever; terminals that never send a paste event keep the guard, since they've never shown they can do better. Also moves the bookkeeping (last keypress time, whether it was printable, whether to swallow the next linefeed) off AppShell and into the key handler's own closure -- nothing outside that handler read it.
TheGreatAxios
force-pushed
the
cl-5541-pasting-into-the-prompt-is-broken
branch
from
August 7, 2026 04:58
f22ee89 to
069df2e
Compare
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
Verification
bun run typecheck,bun run build, andbun testall pass (4320 pass, 0 fail) after rebasing ontorelease/tui-bugfixesESC[200~...ESC[201~), Ctrl+V/Ctrl+P clipboard image attach, and a raw un-bracketed CRLF paste were all observed directly in the rendered framesline one\r\nline two\r\nline threewithout bracketed-paste markers sent "line one" and "line two" as separate messages; after the fix it composes into one three-line prompt, matching bracketed-paste behaviorAppShell-- no new permanent shell stateCloses CL-5541