[BUG] Text copied from the Claude Code TUI and pasted into the prompt is shown on separate lines in the sent message
What's wrong
When a message contains text copied from the Claude Code TUI itself (for example, a phrase from an assistant reply), the sent message renders the pasted text on its own lines, with blank lines added before and after it. The prompt box shows the text inline before sending.
The session JSONL shows the cause. Each paste is stored wrapped as:
\n\n<pasted_content id="3940">\n<pasted text>\n</pasted_content id="3940">\n\n
The transcript view hides the tags but keeps the newlines around them.
This only happens with text copied out of the Claude Code TUI. Text copied from another app and pasted the same way renders inline as expected.
Also, every paste in the session gets the same id (3940).
Steps to reproduce
- Switch to fullscreen rendering with
/tui fullscreen, if it is not already the current mode. - Type some text in the prompt.
- Select and copy a phrase from an earlier assistant message in the Claude Code TUI, then paste it into the prompt.
- Type some more text and press Enter.
Expected: the sent message looks the way it did in the prompt box.
Actual: the pasted phrase appears on separate lines, broken away from the text around it.
Example as stored in the JSONL:
"content":"regarding \"\n\n<pasted_content id=\"3940\">\nDo you want the design doc, or one of the other two routes\n</pasted_content id=\"3940\">\n\n\" - what \"other two routes\" are you talking about?"
Pasting text copied from any other app in step 3 does not reproduce the bug.
Environment
- Claude Code 2.1.277 and 2.1.278
- TUI mode: fullscreen (
/tui fullscreen) - macOS 27.0
- Terminal: Nice, a native macOS terminal. It reports
TERM_PROGRAM=ghostty.
Showing cached comments. Read the full discussion on GitHub ↗
3 Comments
Same on 2.1.278, macOS. Not limited to text copied from the TUI: text copied from a browser (Brave) and dictated text inserted via Cmd+V by Handy (github.com/cjpais/Handy) are both wrapped as
<pasted_content>with blank lines around them, so each paste shows as its own line in the sent message. Typed text soft-wraps normally. All pastes in the session share one id here too.Environment: macOS 15.7.5, kitty, fullscreen TUI mode.
Same on Windows 11, 2.1.278. Hits pastes from any app, even one-sentence ones, and every paste in a session shares the same id.
Also breaks
> quoted textthen reply: the>ends up alone on its own line with the pasted text under it.pasted_contentis absent from my Sep 12 build and present from Sep 16 on.Same issue here. When dictating with Wispr Flow into the Claude Code prompt, chunks of the dictated text arrive wrapped as pasted content instead of typed text:
Some typed-looking text.\n\n<pasted_content id="324a">\nA dictated chunk.\n</pasted_content id="324a">\n\n more text
Three effects: