Long URLs break when ctrl-clicked or copied in terminal due to line wrapping

Resolved 💬 3 comments Opened May 27, 2026 by Kevofehr Closed May 30, 2026

Problem

When Claude Code outputs long URLs in the terminal, they get line-wrapped based on the terminal width. This causes two issues:

  1. Ctrl-click to open the URL in a browser only captures the portion up to the line break, resulting in a truncated URL (404).
  2. Copy-paste of the URL includes line breaks and fragments, producing a broken URL.

This is especially common with product links, GitHub URLs, documentation links, etc. — anything longer than ~80 characters.

Expected behavior

URLs should be clickable and copyable regardless of terminal width. Possible solutions:

  • Use OSC 8 hyperlink escape sequences to wrap URLs so terminals render them as clickable links with short display text
  • Shorten the display text while keeping the full URL in the hyperlink metadata
  • Detect terminal width and avoid breaking URLs mid-line (e.g., place them on their own line with no wrapping)

Environment

  • Windows 11, PowerShell terminal
  • Claude Code CLI
  • Issue is terminal-agnostic (affects Windows Terminal, VS Code integrated terminal, etc.)

Reproduction

  1. Ask Claude Code a question that produces a long URL (e.g., a product link or documentation URL)
  2. Resize the terminal window so it's not full width
  3. Try to ctrl-click or copy the URL — it will be truncated or broken

🤖 Generated with Claude Code

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗