charmbracelet / charmbracelet/x
vt: keep OSC 8 links when the URL contains semicolons
- Dominant language
- Go
- Stars
- 314
- Forks
- 94
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 2
Description
## Problem
An OSC 8 hyperlink is discarded when its URL contains a semicolon.
Only the first two semicolons in an OSC 8 command separate fields. Any later semicolons are part of the URL.
## Minimal reproduction
Using `github.com/charmbracelet/x/vt` at `3755ebad01b1`, write this sequence:
```text
ESC ] 8 ; ; https://example.com/f?a=1;b=2 ESC \ L3 ESC ] 8 ; ; ESC \
```
In Go:
```go
_, _ = emu.Write([]byte("\x1b]8;;https://example.com/f?a=1;b=2\x1b\\L3\x1b]8;;\x1b\\"))
```
## Expected
The cells for `L3` should have this link URL:
```text
https://example.com/f?a=1;b=2
```
## Actual
The link is not attached to the cells. The parser splits at every semicolon and rejects the command when it gets more than three pieces.
## Suggested direction
Split only at the first two semicolons. The remainder belongs to the URL.
## Why this matters
URLs can legally use semicolons, including in query strings and path parameters. The visible text still renders, but the link is no longer clickable.
PR #868 fixes a separate OSC 8 problem where the URL and parameter fields are exchanged. That fix makes ordinary links correct, but URLs containing semicolons still fail.
Contributor guide
Research direction
Start in the github.com/charmbracelet/x/vt OSC 8 parsing path reached by emu.Write, using the minimal reproduction in this issue to observe how semicolons are handled. The work is done when the L3 cells retain the full URL https://example.com/f?a=1;b=2 while the visible text still renders.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 76/100