[FEATURE] Improve code block copy UX in terminal TUI: copy button and clean drag-select
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
Terminal-native copy of code blocks is broken by the hard line break / 2-space indent issue (#15199, #13378). The /copy command (v2.1.59+) provides a workaround via interactive picker, but requires multiple steps even for a single block. There is currently no way to quickly copy a whole code block or cleanly select a portion of one.
Proposed Solution
Two complementary mouse interactions for copying code blocks:
- Copy button — display a small
[Copy]label in the top-right corner of each code block (like GitHub / VSCode). Click to copy the entire raw content to clipboard. - Drag select — drag-select within a code block to copy the selected portion, with soft-wrap line breaks stripped.
Both should copy from the original source text (markdown AST), not the rendered output, to avoid hard-wrap and indentation artifacts. A brief visual feedback (e.g., "Copied!" flash) should confirm the action.
Priority
Medium - Would be very helpful
Feature Category
Interactive mode (TUI)
Use Case Example
- Claude Code outputs a response with code blocks
- I click
[Copy]on a code block → entire raw content is in my clipboard - Or I drag-select a specific portion → only that part is copied, without broken line breaks
Additional Context
The VSCode extension already has copy buttons on code blocks (v1.0.92+). This proposal brings a similar experience to the terminal TUI, extended with drag-select for partial copy.
This consolidates related requests: #29030 (copy on select), #33016 (copy button), #859 (raw markdown copy).
Related: #15199, #13378, #5512, #23014
4 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
This is not a duplicate. The referenced issues address fragments of the same problem:
This issue intentionally consolidates these into a single proposal: a copy button on code blocks + clean drag-select. Both are complementary and address different use cases (whole block vs. partial copy).
Closing this issue — the proposal ended up covering two separate features (copy button + drag-select), which overlaps with existing issues that each address them individually:
Deferring to those issues instead.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.