[BUG] Long URLs split across multiple lines in terminal output, breaking copyability

Resolved 💬 2 comments Opened Oct 14, 2025 by shubhamgupta731 Closed Oct 15, 2025

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?

Description

When Claude Code responds with messages containing long URLs, the URLs are wrapped across multiple lines in the terminal output without proper escaping. This makes the URLs unusable as users cannot directly copy them - they must manually select the text across multiple lines and then manually remove line breaks to reconstruct the original URL.

Additional Context

This is particularly problematic for:

  • OAuth authorization flows (MCP server authentication)
  • API endpoint documentation
  • Long query strings
  • Encoded URLs with special characters

Users expect to click or copy URLs directly from terminal output, which is standard behavior in modern terminal applications.

What Should Happen?

Expected Behavior

Long URLs should be:

  • Either wrapped in code blocks/fenced sections to prevent line wrapping
  • Or rendered as markdown links [descriptive text](url) so the URL itself isn't displayed inline
  • Or properly escaped so terminal selection captures the complete URL
  • Users should be able to copy-paste URLs directly without manual text manipulation

Suggested Solutions

  1. Markdown Links: Always present URLs as markdown links:

``markdown
[Click here to authorize](https://very-long-url...)
``

  1. Code Blocks: Wrap long URLs in single-line code blocks:

``markdown
Authorization URL:
https://very-long-url...
``

  1. Terminal-Safe Formatting: Use ANSI escape codes or terminal-specific formatting to prevent line breaks within URLs
  1. Truncation with Copy: Display truncated URL with instruction to copy from a specific location:

``markdown
Authorization URL (copied to clipboard): https://example.com/...
``

Error Messages/Logs

NA

Steps to Reproduce

Steps to Reproduce

  1. Trigger any Claude Code response that includes a long URL (e.g., OAuth authorization URLs, API endpoints with query parameters, etc.)
  2. Observe the terminal output
  3. Attempt to copy the URL directly

Actual Behavior

Long URLs are displayed as plain text and wrapped across multiple lines based on terminal width. When copying, users get:

https://example.com/oauth2/authorize?client_id=123456789&redirect_uri=http%3A%2F%2
Flocalhost%3A8000&scope=email+profile+calendar&response_type=code&state=abc123&acce
ss_type=offline&prompt=consent

Instead of:

https://example.com/oauth2/authorize?client_id=123456789&redirect_uri=http%3A%2F%2Flocalhost%3A8000&scope=email+profile+calendar&response_type=code&state=abc123&access_type=offline&prompt=consent

Example

A typical problematic response:

Authorization URL: https://accounts.example.com/o/oauth2/auth?response_type=code&client_id=123456789-abcdefghijklmnop.apps.example.com&redirect_uri=http%3A%2F%2Flocalhost%3A8000%2Fcallback&scope=https%3A%2F%2Fwww.example.com%2Fauth%2Fcalendar+https%3A%2F%2Fwww.example.com%2Fauth%2Femail&state=randomstate123&access_type=offline&prompt=consent

This URL spans multiple lines in the terminal, and copying it requires manual line joining.

Claude Model

Sonnet (default)

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

2.0.14

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

iTerm2

Additional Information

_No response_

View original on GitHub ↗

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