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 month ago • 3 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

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/6827
  2. https://github.com/anthropics/claude-code/issues/13378
  3. https://github.com/anthropics/claude-code/issues/10969

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

github-actions[bot] avatar Dec 23 '25 23:12 github-actions[bot]

👎 This is intentionally a consolidation issue, not a duplicate.

The referenced issues (#6827, #13378, #10969) are fragmented reports of the same root problem - several have been closed as duplicates of each other without resolution.

This issue adds new context not present in any of the others:

  1. Token cost analysis - workarounds in CLAUDE.md waste tokens every session across 115k users
  2. Adoption context - rapid growth means new users hitting this without knowing workarounds
  3. Desktop/Web parity gap - explicit comparison showing CLI lacks copy mechanisms that Desktop/Web have
  4. Consolidated evidence - 5 related issues with 50+ combined upvotes proving community scope

The goal is to frame the full problem in one place rather than having it scattered across half-closed duplicates. Please keep this open for proper triage.

pentafive avatar Dec 23 '25 23:12 pentafive