[FEATURE] Improve code block copy UX in terminal TUI: copy button and clean drag-select

Status Fixed / completed
Maintainer reply None cached
Activity 4 comments · opened Mar 15, 2026 · closed Mar 15, 2026

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:

  1. 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.
  2. 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

  1. Claude Code outputs a response with code blocks
  2. I click [Copy] on a code block → entire raw content is in my clipboard
  3. 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

View original on GitHub ↗

4 Comments

github-actions[bot] · 7 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/29030
  2. https://github.com/anthropics/claude-code/issues/33016
  3. https://github.com/anthropics/claude-code/issues/859

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

oda251 · 7 months ago

This is not a duplicate. The referenced issues address fragments of the same problem:

  • #29030 — copy on select
  • #33016 — copy button for commands
  • #859 — raw markdown copy

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).

oda251 · 7 months ago

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:

  • #33016 — copy button on code blocks
  • #29030 — copy on select (drag-select)

Deferring to those issues instead.

github-actions[bot] · 6 months ago

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.