[BUG] Text wrapping breaks long URLs in assistant output
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 outputs a URL that wraps onto multiple lines, I can't easily copy/paste the URL or open it in my browser.
Example
Using the following test prompt when wrapping is set to 49 columns:
output this URL and nothing else: https://github.com/anthropics/claude-code/issues/609#issuecomment-3721545051
This results in the following:
❯ output this URL and nothing else:
https://github.com/anthropics/claude-code/issu
es/609#issuecomment-3721545051
⏺ https://github.com/anthropics/claude-code/issue
s/609#issuecomment-3721545051
If I copy and paste the URL into a text editor (or even Claude's own user input field), I get this:
https://github.com/anthropics/claude-code/issue
s/609#issuecomment-3721545051
(Note the extra spaces and line break between issue and s/609)
In Terminal.app on macOS, I can use <kbd>Command</kbd> + <kbd>double click</kbd> (or <kbd>right click</kbd> > "Open Link") to open a URL in my browser. When I do either of those things with the above output, my browser opens the following URL, which doesn't exist:https://github.com/anthropics/claude-code/issue
| Before right-clicking | After right-clicking | After clicking "Open Link" |
|--------|--------|--------|
| <img alt="Image" src="https://github.com/user-attachments/assets/ed29ef77-3c8e-457d-99dc-8ef572094d3c" /> | <img alt="Image" src="https://github.com/user-attachments/assets/9d1e1300-f85f-4330-88b3-c749a6800c8e" /> | <img alt="Image" src="https://github.com/user-attachments/assets/45a96160-6758-4c6d-8906-3de4997f415f" /> |
What Should Happen?
Given the following assistant output:
⏺ https://github.com/anthropics/claude-code/issue
s/609#issuecomment-3721545051
When I trigger the "Open Link" action on the URL (either with <kbd>Command</kbd> + <kbd>double click</kbd> or by selecting "Open Link" from the right-click contextual menu thing), the following URL should open in my browser:https://github.com/anthropics/claude-code/issues/609#issuecomment-3721545051
When I copy the URL, my clipboard contents should exactly match the following:https://github.com/anthropics/claude-code/issues/609#issuecomment-3721545051
Error Messages/Logs
Steps to Reproduce
- Set your terminal to a width of 49 columns.
- Run
claude - Enter the following prompt:
````
output this URL and nothing else: https://github.com/anthropics/claude-code/issues/609#issuecomment-3721545051
- Copy the resulting output to your clipboard and paste it into a text editor.
- Alternatively, try opening the URL directly from your terminal. In Terminal.app on macOS, you can do this by either holding down <kbd>Command</kbd> and double clicking on the URL, or right clicking on the URL and selecting "Open Link".
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.131 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
Version info
- Terminal.app version:
Version 2.14 (455.1) - macOS version:
15.6.1 (24G90)
Other issues
- Very similar issue, auto-closed back in January: https://github.com/anthropics/claude-code/issues/609
- Seems like it started working again for at least one user https://github.com/anthropics/claude-code/issues/609#issuecomment-3721545051
- Maybe it's regressed again since then? Or possibly just a very different terminal/shell config.
- Another related issue, currently open: https://github.com/anthropics/claude-code/issues/48251
A few bonus test screen recordings just for fun
- Copying and pasting into Sublime Text 4
- Copying and pasting into an
<input>element - Used this MDN playground and adjusted the first input element to be 500px wide so the entire URL fits without any horizontal overflow.
- Copying and pasting into Chrome's address bar
- The Chrome case is interesting because unlike the other cases, the pasted URL is properly formed. Perhaps Chrome auto-strips extra spaces from the entire string (not just the beginning and the end of the string) when it detects something it thinks might otherwise be a URL?
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗