Code blocks copy with leading spaces, breaking paste into terminals
Resolved 💬 2 comments Opened Mar 23, 2026 by mhpavl Closed Apr 21, 2026
Description
When copying code blocks from Claude Code's terminal output, leading spaces are included in the copied text. This causes issues when pasting into shells or REPLs (e.g., Python's IndentationError: unexpected indent).
Steps to reproduce
- Ask Claude Code to output a multi-line code block (e.g., Python snippet)
- Select and copy the code block from the terminal output
- Paste into a terminal or Python REPL
Expected behavior
Code should copy without leading whitespace so it can be pasted directly into a terminal.
Actual behavior
Each line has leading spaces added, which breaks Python code and shell commands.
Screenshot
The code block renders with visible indentation that gets included in the clipboard:
from demoserver.api.s3 import S3Manager
from django.conf import settings
s3 = S3Manager()
Pasting this into a Python shell gives IndentationError: unexpected indent.
Environment
- macOS (Darwin 25.3.0)
- Claude Code CLI
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗