Multi-line code blocks are not reliably copy-pasteable from the terminal
Problem
When Claude Code outputs a fenced code block (KQL, SQL, bash, etc.), the terminal renderer applies syntax highlighting, soft-wrapping, and sometimes leading gutter/indentation. Selecting the block with the mouse copies the rendered text — soft-wrapped lines gain hard newlines, highlight spacing is altered, and pasting into a query editor / SQL console / shell produces broken input. For anything longer than a couple of lines, copy-paste is effectively unusable.
Impact
The terminal is the primary surface, yet the most common payload (code) can't be moved out of it cleanly. The current workaround is asking Claude to write the snippet to a file and opening it in an editor — which defeats the purpose of inline output.
Requests (any one would help)
- A per-code-block "copy" affordance (keybinding or click) that yields the raw, unwrapped, unhighlighted source.
- A command to dump the last code block (or last N) to the clipboard / a temp file verbatim.
- Disable soft-wrap inside code blocks (horizontal scroll instead), so a mouse-select preserves the original line breaks.
- Preserve original block content on copy regardless of rendered syntax highlighting.
Environment
- Claude Code CLI on Windows (Windows Terminal / PowerShell).
- Reproduces with any multi-line fenced code block long enough to soft-wrap.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗