[BUG] TUI mouse-selection copy strips rich clipboard flavors (no public.html)
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report
- [x] I am using the latest version of Claude Code
What's Wrong?
When I select text with the mouse inside the Claude Code TUI and copy it (via Ghostty's copy-on-select or an explicit ⌘C), the clipboard receives only plain-text flavors — the terminal's rich public.html flavor is missing. Selecting and copying the same text outside the TUI (at a plain shell prompt, same Ghostty window) does produce public.html. So the TUI's selection capture is intercepting the selection and writing plain text only.
Evidence via osascript -e 'clipboard info':
- Inside TUI:
«class utf8», «class ut16», string, Unicode text— no«class HTML» - Outside TUI (shell prompt, same window): includes
«class HTML»
This silently breaks downstream tooling that reconstructs formatting (bold, inline code) from the styled clipboard flavor — there's nothing styled left to reconstruct from.
What Should Happen?
Copying a TUI selection should preserve the terminal's rich clipboard flavors (e.g. public.html), the same way a native terminal selection does — or there should be a setting to disable the TUI's selection capture and fall back to terminal-native selection/copy.
Error Messages/Logs
_None._
Steps to Reproduce
- Ghostty 1.3.1 on macOS (copy-on-select enabled; ⌘C also reproduces).
- In a Claude Code session, mouse-select assistant output that contains styled text (bold / inline code).
- Copy (⌘C).
- Run
osascript -e 'clipboard info'→ only plain-text flavors; no«class HTML». - Control: drop to a plain shell prompt (outside the TUI) in the same window, select text, ⌘C,
osascript -e 'clipboard info'→«class HTML»present.
Claude Model
Not sure / Multiple models _(bug is model-independent)_
Is this a regression?
Yes, this worked in a previous version
Last Working Version
Unknown — possibly tied to the mouse-selection rework around v2.1.187 (see #71085)
Claude Code Version
2.1.197
Platform
Anthropic API
Operating System
macOS (15.7.7, build 24G720)
Terminal/Shell
Other — Ghostty 1.3.1
Additional Information
- The terminal itself still emits
public.htmlfor native selections (control test above), so the change is on the Claude Code side, not Ghostty. - Possibly related: #71085 ("Mouse text selection and history scroll broken in MobaXterm after v2.1.187") — may share the same TUI selection-handling change.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗