Copied text has unwanted 2-space base indentation
Description
When copying text from Claude Code output (both prose and code blocks), every line has an unwanted 2-space base indentation that isn't part of the actual content. This breaks pasting into indentation-sensitive files (YAML, Python, etc.) and requires manual cleanup every time.
This is especially bad when copying CLI commands. Claude Code wraps long commands across multiple lines for display, and when copied, the display line-wrap becomes a real line break with indentation — silently changing the command.
Examples
CLI command wrapping (worst case)
Claude outputs a single-line command like:
docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d --build myservice
When the terminal is too narrow, it wraps for display. When copied, it becomes something like:
docker compose -f docker-compose.yml -f
docker-compose.prod.yml up -d --build myservice
The display wrap becomes a real line break, silently breaking the command. The user gets an error or wrong behavior with no indication the copy was corrupted.
Code blocks
Claude renders:
- name: Deploy service
copy:
dest: /etc/myservice.conf
Copies as:
- name: Deploy service
copy:
dest: /etc/myservice.conf
Every line gains 2 extra leading spaces, breaking indentation-sensitive formats.
Prose text
Bullet points and wrapped paragraphs also pick up extra base indentation on every line.
Environment
- Claude Code version: 2.1.85
- OS: Linux (WSL2) 5.15.153.1-microsoft-standard-WSL2
- Shell: zsh
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗