claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[BUG] CLI output formatting artifacts break copy/paste - workarounds waste tokens

Open pentafive opened this issue 1 week ago • 2 comments

Summary

Claude Code CLI adds formatting artifacts to ALL output that break copy/paste workflows:

  • 2-space leading indentation on every line
  • Hard line breaks at ~80 characters (breaks words mid-character)

These artifacts are included when copying text, requiring manual cleanup for every paste operation.

Environment

  • Platform: WSL2 on Windows 11 (also reported on macOS, native Linux)
  • Claude Code Version: 2.0.x
  • Terminal: Various (Windows Terminal, iTerm, Terminal.app)

Reproduction

  1. Run any Claude Code session
  2. Have Claude output multi-line text (commands, code, prose)
  3. Copy the output to clipboard
  4. Paste into a plain text editor

Expected: Clean text matching what Claude generated Actual: Text has 2-space indent on each line + hard breaks at ~80 chars

Impact

Workflow Disruption

Every copy/paste requires cleanup:

  • VSCode: Select all → Shift+Tab to remove indent
  • Manual deletion of unwanted line breaks
  • Commands fail silently when pasted (extra spaces/breaks)

Token Cost of Workarounds

Users have resorted to adding prompts in CLAUDE.md memory files like:

"Use \ line continuations for commands to survive copy/paste"

These workarounds consume tokens on every session. Users are paying (in tokens and context window) to work around a rendering bug. Across the user base, this adds up significantly.

Community Workarounds Shouldn't Be Necessary

Tools like claude-fix exist to clean copied text. While appreciated, Claude Code shouldn't require external tooling to fix its own output. The tooling should be fixed at the source.

Desktop/Web Parity Gap

Feature Desktop/Web CLI
Code block copy button ✅ Yes ❌ No
Clean raw text access ✅ Yes ❌ No
Formatting artifacts in copy ❌ None ⚠️ Indent + breaks

Claude Desktop and claude.ai provide clean copy mechanisms. CLI users have no equivalent.

Rapid Adoption Context

Claude Code is experiencing explosive growth:

  • 115,000 developers using Claude Code (source)
  • 195 million lines of code processed in a single week
  • 300% user base growth with 5.5x revenue jump
  • Content creators like NetworkChuck actively promoting CLI-based AI workflows
  • DeepLearning.AI and Udemy courses driving new user onboarding

This means:

  1. New users are flooding in - they won't know workarounds
  2. First impressions matter - broken copy/paste is a bad UX for newcomers
  3. Token waste scales with adoption - 115k developers × wasted tokens = significant

Fixing this now benefits the rapidly growing community before frustration sets in.

Related Issues (Evidence of Scope)

This problem has been reported multiple times, often closed as duplicates without resolution:

  • #6827 - Hard line breaks at ~80 chars (13 upvotes, at risk of autoclose)
  • #859 - Simplify copying markdown output (37+ upvotes)
  • #13378 - 2-space indent + hard wrap breaks copy/paste
  • #5097 - Copied text contains extra formatting characters (closed as dup)
  • #4686 - Copy-paste introduces extra spaces (closed as dup)

The community clearly wants this fixed.

Proposed Solutions

Any of these would help:

  1. Remove formatting artifacts - Don't add indent/hard breaks server-side (preferred)
  2. Add /copy command - Copy last output as clean text to clipboard
  3. Add /show-raw command - Display raw text without rendering
  4. Add config option - --no-format or settings to disable output formatting

pentafive avatar Dec 23 '25 23:12 pentafive