Code blocks add leading whitespace when copied from terminal output
Status Closed — not planned
Maintainer reply None cached
Activity 1 comment · opened Apr 1, 2026 · closed Apr 1, 2026
Description
When Claude Code outputs code blocks (fenced with triple backticks) in the terminal, copying and pasting the content into another terminal adds leading whitespace to every line. This breaks:
- Shell heredocs (closing
EOFdelimiter not recognized with leading spaces) - Config files (keys get split across lines or indented incorrectly)
- Any content where leading whitespace is significant
Reproduction
- Ask Claude Code to output a multi-line config file in a code block
- Copy the content from the terminal
- Paste into another terminal or file
- Observe leading spaces on every line
Impact
Users pasting config files, shell scripts, or heredocs into remote servers get corrupted output. This came up while configuring opendkim via SSH — every approach (heredocs, printf, echo) produced broken files due to invisible leading whitespace added by the rendering layer.
Expected behavior
Code block content should be copyable without any added leading whitespace.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗