Long lines in output contain hard newlines, breaking copy-paste
Description
Claude Code's output renderer inserts hard newlines (not soft wraps) when text exceeds the terminal width. This means copying any long line from Claude Code's output — whether from a code block or inline text — pastes with literal newlines and indentation at the wrap points.
Steps to Reproduce
- Ask Claude Code to output a long single-line command (e.g., a long
echooradbcommand) - The command wraps visually in the terminal
- Select and copy the wrapped text
- Paste into the terminal or any text field
Expected Behavior
The pasted text should be a single continuous line (the terminal soft-wrapped it visually, but the underlying text has no newlines).
Actual Behavior
The pasted text contains literal newlines and leading spaces at each wrap point, breaking the command. For example:
echo "this is a long command that should wrap around the terminal window to test whether copying
and pasting works correctly with the new clipboard settings enabled"
Instead of:
echo "this is a long command that should wrap around the terminal window to test whether copying and pasting works correctly with the new clipboard settings enabled"
Environment
- Claude Code (latest, via CLI)
- Tested on both Ghostty 1.2.3 and iTerm2 3.6.6 on macOS — same behavior in both
- Copying from
cator other terminal programs works correctly, confirming this is a Claude Code rendering issue, not a terminal issue - macOS Darwin 24.6.0
Impact
This makes it impossible to copy-paste commands from Claude Code output without manual cleanup. Long commands (e.g., adb commands, SSH commands with arguments) are frequently broken.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗