[BUG] Hard newlines at visual wrap points corrupt copied text
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When Claude Code wraps long lines of output to fit the terminal width, it inserts actual \n characters at the wrap boundary rather than relying on the terminal's soft-wrap. When the text is selected and pasted (via standard Linux primary selection — select then middle-click), these hard newlines are included, producing broken, malformatted output.
Primary selection (select → middle-click paste) works fine. The issue is exclusively the hard newlines injected at wrap points.
What Should Happen?
It should behave as opencode. Simply!
Error Messages/Logs
Any wrapped output copied from Claude Code is malformatted on paste. Multi-line responses require manual cleanup every time, making the clipboard workflow significantly worse than competing tools.
Steps to Reproduce
- Run Claude Code in Konsole
- Ask anything that produces a long wrapped response
- Select the output text with left-click drag
- Paste with middle-click
Result: Pasted text contains newlines at every visual line break, breaking paragraphs and making the output unusable as-is.
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.105
Platform
Anthropic API
Operating System
Other Linux
Terminal/Shell
Other
Additional Information
Environment
- OS: Linux archlinux (KDE Plasma)
- Terminal: KDE Konsole
Example
Pasted from Claude Code (broken):
This is a long response that wraps because the terminal is not wide
enough to fit it on one line and the result is that copying it
produces broken text with unwanted newlines everywhere.
Pasted from opencode (correct):
This is a long response that wraps because the terminal is not wide enough to fit it on one line and the result is that copying it produces broken text with unwanted newlines everywhere.
Comparison
| Behaviour | Claude Code | opencode |
|---|---|---|
| Copied text free of wrap newlines | No | Yes |
Both tools tested on identical system/terminal with no configuration changes between tests.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗