Skip to content

[BUG] Copied text contains extra formatting characters #5097

@dstolts

Description

@dstolts

Environment

  • Platform (select one):
    • Anthropic API
    • AWS Bedrock
    • Google Vertex AI
    • Other:
  • Claude CLI version:
  • Operating System: Windows 11
  • Terminal: PowerShell (Windows Terminal)

Bug Description

When copying text from my own chat input in Claude Code, extra formatting characters (spaces and vertical bars) are added to the copied text, making it impossible to reuse previously typed commands or text.

Steps to Reproduce

  1. Type a multiline command or text in the Claude Code chat input box
  2. don't Send the message
  3. Try to copy the text from your own input in the chat window
  4. Paste the copied text into a text editor or terminal

Expected Behavior

The copied text should be exactly what was typed, without any additional formatting characters, spaces, or vertical bars.

Actual Behavior

The copied text includes:

  • Extra spaces at the beginning of lines
  • Vertical bars (|) or other formatting characters
  • Additional whitespace that wasn't in the original input

Example:
Original typed: npm start
What gets copied: | npm start or similar with extra formatting

Additional Context

  • This issue makes it very difficult to reuse commands from chat window
  • Related to issue Copy-paste from Claude Code introduces extra spaces/characters in code blocks #4686 but specifically affects copying from user's own input, not Claude's output
  • Significantly impacts productivity when working with complex and multi-line commands
  • Forces users to retype everything instead of copying from their own chat window or opening an .md file to paste then cleanup the formatting

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions