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

Resolved 💬 4 comments Opened Mar 15, 2026 by oda251 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 ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗