Copying code blocks from TUI adds leading whitespace

Resolved 💬 3 comments Opened Mar 21, 2026 by JPHutchins Closed Mar 21, 2026

Description

When copying code blocks from Claude Code's TUI output, the copied text includes leading whitespace (spaces) that are not part of the actual content. This is visual padding used for rendering markdown code blocks, but terminals copy it as content.

Steps to reproduce

  1. Have Claude output a code block (e.g. a config file snippet or shell command)
  2. Select and copy the code block text from the terminal
  3. Paste it elsewhere (e.g. into nano, another terminal, etc.)

Expected behavior

Copied text should not include the visual padding/indentation added by the TUI renderer.

Actual behavior

Every line gets 2 extra leading spaces prepended, making pasted content incorrect for whitespace-sensitive contexts (heredocs, YAML, etc.) and annoying for everything else.

Impact

Makes it difficult to use Claude Code for generating config snippets, commands, or code that needs to be pasted into other terminals or editors — a common workflow when managing remote servers.

View original on GitHub ↗

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