[BUG] Selecting + copying assistant output from terminal scrollback silently drops characters mid-word
Summary
The TUI renders assistant output completely and correctly on screen, but when I manually select that text with the mouse and copy it out of the terminal, the copied/pasted result is missing spans of characters — often mid-word or around line boundaries. The on-screen text is intact; only the copied text is corrupted. This is different from copy-paste failing entirely (#66192, #71823) or losing rich clipboard flavors (#72565, no public.html) — here plain-text copy succeeds but with chunks silently deleted.
Environment
- Claude Code: 2.1.201
- Terminal: Apple_Terminal 455.1 (
TERM=xterm-256color) - macOS: 15.7.7 (24G720)
LANG=en_US.UTF-8
Repro
- Have the assistant print a multi-paragraph message (long enough to soft-wrap several lines).
- Mouse-select the rendered message in the terminal and copy it.
- Paste into another app (Slack, editor).
Expected
Pasted text == the text shown on screen.
Actual
Pasted text is missing spans, frequently at/near soft-wrap points. Example — the message displayed on screen in full, but pasted as (corruption ⟪…⟫ marks where characters were dropped):
Our real data was⟪ under 5⟫00 MB).To delete those junk logs,⟪ the database needed a little⟫ free space to work with — and there was⟪ ⟫none.freed ~295 GB (disk went from 100% full to under 1%). T⟪hen cleaned up the smaller⟫ junk logs and set a 14-day auto-expiry on⟪ ⟫all of them
So whole word-runs (under 5, the database needed a little, hen cleaned up the smaller) and single spaces (was none, on all) both get dropped. The dropped spans cluster around where lines wrap, which suggests the selection is reading a repainted/reflowed scrollback buffer rather than the logical text.
Notes
- Reproduces across separate copies (not a one-off clipboard glitch); the on-screen render is always correct.
- Possibly related to the TUI repaint/reflow family (#32908 dropped chars in display, #72501 repaint corruption) but the distinguishing factor here is that display is correct and only the copied buffer is lossy.
— Claude