Inline-code (backtick) URLs aren't emitted as OSC 8 hyperlinks, so they break on line-wrap while bare URLs work
Summary
Claude Code emits bare URLs as OSC 8 hyperlinks (so they're cmd/ctrl-clickable even when they wrap across lines), but URLs rendered inside an inline-code span (markdown backticks) are not wrapped in OSC 8. As a result, a code-formatted URL falls back to the terminal's per-line URL auto-detection, and when it wraps it cmd-clicks to a truncated fragment (404), while the identical bare URL on the same screen works fine.
This is a narrower, still-reproducible slice of the long-running "long URLs break on line-wrap" theme. The general case appears to have been partially fixed (bare URLs now get OSC 8 — see below), but the inline-code render path was left out.
Repro
In a narrow terminal pane (so URLs wrap), have Claude print the same long URL twice — once bare, once in backticks:
Bare:
https://example.com/very/long/path/with/many/segments?a=1&b=2&c=3&d=4&e=5&f=6&g=7&h=8
Inline code:
https://example.com/very/long/path/with/many/segments?a=1&b=2&c=3&d=4&e=5&f=6&g=7&h=8
Cmd-click (macOS) / Ctrl-click each where it wraps:
- Bare → opens the full URL correctly. ✅ (OSC 8 hyperlink; wrapping irrelevant)
- Inline code → opens only the clicked row's fragment → broken/404. ❌ (no OSC 8; terminal's single-row smart-selection)
Confirmed in iTerm2 (split pane forcing the wrap): bare URLs opened correctly across the wrap; backticked ones broke. iTerm2 opens long OSC 8 hyperlinks fine, so this is a CC-side choice not to emit the sequence for inline-code, not a terminal limitation.
Expected
URLs inside inline-code spans should also be emitted as OSC 8 hyperlinks (apply the same link() wrapper already used for bare URLs), so they're clickable regardless of line-wrap. The visible monospace styling can stay; only the hyperlink metadata needs to be added.
Why it matters
Inline code is the natural way to present a URL when it sits among prose or alongside other code-formatted tokens, so this is a common path — and it's the one case where clicking silently gives you a wrong/truncated destination rather than failing obviously.
Environment
- Claude Code: 2.1.183
- OS: macOS 26.5
- Terminal: iTerm2 (reproduces in any terminal that does per-row URL detection; OSC 8-aware terminals all handle the bare case correctly)
Related (all closed)
- #33539 — OAuth/MCP auth URLs broken by wrapping (closed NOT_PLANNED; bottom of the dedup chain for this whole theme; comments note the fix is to apply the existing
link()OSC 8 wrapper) - #48652 — "Support OSC 8 hyperlink sequences for file paths and URLs in TUI output" (closed NOT_PLANNED)
- #54343, #54606, #62678 — long-URL-wrapping reports, auto-closed as duplicates into the above
None of these isolate the bare-vs-inline-code asymmetry, which is sharply scoped and trivially reproducible.