[BUG] Code blocks in assistant responses have leading whitespace when copied

Resolved 💬 2 comments Opened Jun 10, 2026 by cclxxi Closed Jun 14, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

When copying code blocks from assistant responses, each line has leading spaces (indentation) that shouldn't be there.
This makes it impossible to paste multi-line code directly into a terminal or file without manual cleanup.

What Should Happen?

No leading whitespace on each line

Error Messages/Logs

Steps to Reproduce

Steps to reproduce:

  1. Ask Claude for a multi-line code snippet
  2. Copy the code block
  3. Paste into terminal

Claude Model

Not sure / Multiple models

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

2.1.170 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

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