Merge consecutive [Pasted text #N] chunks into a single placeholder
Problem
When pasting large text into Claude Code, the terminal's bracketed-paste mode delivers the content in multiple stdin chunks (typically 64 KB–1 MB depending on the emulator). Claude Code currently renders each chunk as its own [Pasted text #N +X lines] placeholder, so a single user paste appears as e.g.:
[Pasted text #10 +123 lines][Pasted text #11 +72 lines]
To a user not paying close attention, this looks like the paste was duplicated or fragmented across separate user actions, when in reality it was a single Cmd+V / Ctrl+V.
Proposed behavior
If two [Pasted text #N] placeholders arrive back-to-back within a short debounce window (e.g. ≤100 ms apart, no other input between them), merge them into a single placeholder with the combined line count:
[Pasted text #10 +195 lines]
Why
- Removes a confusing visual artifact caused by terminal/pty implementation details that the user has no control over.
- No information is lost — the merged placeholder is still collapsible and still expands to the full content.
- Aligns the visual representation with the user's mental model: one paste action → one placeholder.
Related issues
- #35581 — Option to disable paste collapsing entirely (different ask, but same area)
- #29375 — Show full pasted text instead of placeholder
- #50076, #49337, #46953, #49673 — Various paste truncation bugs (different root cause, but same code path)
Repro
Paste a sufficiently large block (e.g. 200+ lines) into the Claude Code prompt in iTerm2, Windows Terminal, or VS Code's integrated terminal. Observe two or more consecutive [Pasted text #N] placeholders for what was a single paste.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗