Skip to content

Long URLs break at hyphens (or any char) in word-wrap, breaking clickable links #4923

@jondoran

Description

@jondoran

What happened?

splitIntoTokensWithAnsi in packages/tui/src/utils.ts only splits tokens on spaces.

URLs contain no spaces, so long URLs become one token and get broken character-by-character via breakLongWord.

If the break falls after a - in the URL (e.g. 2026-05- for date slugs), URLs in the TUI get truncated so links are no longer clickable.

Possible fix: treat URL-safe punctuation (/, ., -, ?, &, =, _, ~, %, :, #, @) as token separators so URLs break at natural boundaries. A PUNCTUATION_REGEX already exists in the same file.

Steps to reproduce

Using Windows Powershell (presumably also any other terminal client), prompt pi to respond with a long URL like https://mydomain.com/01-02-03-04-05-06-07-08-09-10-11-12-13-14-15-16-17-18-19-20-21-22-23-24-25/index.html that breaks across more than one line and click on the link. The URL will be truncated and will not load in the default browser.

Expected behavior

The full URL survives the line break and loads correctly in the default browser when clicked.

Version

0.74.0

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinginprogressIssue is being worked on

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions