You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Hyperlink colorization broken with hyphens in terminal output #2634
Just a quick fire and forget model response. Maybe this helps...
## Problem Analysis
The issue is in packages/tui/internal/util/file.go:89-90. The current regex:
hyphenRegex := regexp.MustCompile(`-([^ \-|]|$)`)
content = hyphenRegex.ReplaceAllString(content, "\u2011$1")
This temporarily replaces hyphens with non-breaking hyphens (\u2011) to prevent line wrapping, but it interferes with URL detection during markdown rendering.
## Proposed Fix
The solution is to modify the hyphen replacement logic to exclude URLs. Here's the approach:
1. Add URL detection regex to identify URLs in the content
2. Use negative lookahead or URL-aware replacement to skip hyphens within URLs
3. Preserve the original line-breaking prevention for non-URL text
May I add to this issue, something that I seem to be experiencing in the same context as the issue above.
I actually am in a worse (maybe) situation, I have bad urls and not only http but any protocol, opencode never prints the "//" (double slash) after the protocol for some weird reason. Here is a screenshot that explains the issue:
Environement:
OS: Arch linux (Omarchy)
shell: Bash
terminal: Alacritty
Notes:
@madflow please tell me if you mind I can create another ticket, but I have a feeling they are both related.
@thegreyfellow Lets wait for the Opentui migration to be finished and do a retest then. Maybe this // is similiar not sure. I would argue if it still exists after the update, a new issue would be best.
Line 90 replaces hyphens: https://github.com/saffron\u2011health/monorepo
Line 91 renders with glamour/goldmark (which doesn't recognize \u2011 in URLs)
URL parsing breaks at saffron because \u2011 is not a valid URL character
Line 111 converts \u2011 back to -, but too late—the URL was already parsed incorrectly
Verification
I tested goldmark directly and it parses URLs with hyphens correctly. The issue is specifically the non-breaking hyphen replacement happening before markdown rendering.
Suggested Fix
The hyphen replacement should either:
Skip URLs entirely (use regex negative lookahead for URL patterns)
Be moved after markdown rendering (though this may break the original line-wrapping intent)
Use a URL-aware parser to preserve URLs while still preventing line breaks in other text
May I add to this issue, something that I seem to be experiencing in the same context as the issue above.
I actually am in a worse (maybe) situation, I have bad urls and not only http but any protocol, opencode never prints the "//" (double slash) after the protocol for some weird reason. Here is a screenshot that explains the issue:
...
Activity
madflow commentedon Sep 16, 2025
Just a quick fire and forget model response. Maybe this helps...
thegreyfellow commentedon Sep 23, 2025
Description:
May I add to this issue, something that I seem to be experiencing in the same context as the issue above.
I actually am in a worse (maybe) situation, I have bad urls and not only http but any protocol, opencode never prints the "//" (double slash) after the protocol for some weird reason. Here is a screenshot that explains the issue:
Environement:
Notes:
@madflow please tell me if you mind I can create another ticket, but I have a feeling they are both related.
rekram1-node commentedon Sep 23, 2025
Dax is currently migrating opencode to use opentui and I think some problems like this will be resolved by it
madflow commentedon Sep 23, 2025
@thegreyfellow Lets wait for the Opentui migration to be finished and do a retest then. Maybe this
//is similiar not sure. I would argue if it still exists after the update, a new issue would be best.tanishqkancharla commentedon Oct 3, 2025
Additional Details on Root Cause
I can confirm this bug with a specific example:
https://github.com/saffron-health/monorepogets cut off at "saffron".Root Cause Analysis
The bug is in
packages/tui/internal/util/file.go:89-90:Bug flow:
https://github.com/saffron-health/monorepohttps://github.com/saffron\u2011health/monorepo\u2011in URLs)saffronbecause\u2011is not a valid URL character\u2011back to-, but too late—the URL was already parsed incorrectlyVerification
I tested goldmark directly and it parses URLs with hyphens correctly. The issue is specifically the non-breaking hyphen replacement happening before markdown rendering.
Suggested Fix
The hyphen replacement should either:
thegreyfellow commentedon Oct 3, 2025
This was fixed in 0.14 , thank you guys 🚀
madflow commentedon Nov 2, 2025
Fixed in 1.0.11