-
Couldn't load subscription status.
- Fork 5
Description
Not sure if this should be reported here, or on the vty parent repo....
In any case, as far as I can tell, OSC-8 hyperlinks emitted by vty-unix does not set the URI ID. The ID is important, since it allows the terminal to match multiple URL (possibly disjoint) parts. See https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda#hover-underlining-and-the-id-parameter for details.
The specification mostly discusses an URL being split into multiple parts by either being line-wrapped across panes, or by being covered by "popups".
There's another issue though, and that's e.g. updating parts of an already printed URL, or opening/closing the OSC-8 hyperlink several times while printing an URL. One way to trigger this would be if the TUI "updates" part of an already existing URL.
From the terminal's perspective, starting a new OSC-8 sequence is the same as starting a new hyperlink; it may assign a completely different autogenerated ID than the last time. Even if the URL part of the sequence is the same (it's a bad idea to assign IDs by hashing the URL, since then multiple instances of the same URL will be treated as one and the same).
Depending on how the terminal renders OSC-8 hyperlinks, various visual glitches can happen:
- A split-up URL (e.g. line-wrapped in a pane) might only by partly underlined/highlighted on hover
- A terminal that assigns jump-marks to URLs (for keyboard access) may display multiple labels/marks for a single URL
Since it would be a bad idea for vty to auto-assign an ID (as mentioned above, you shouldn't base it on the URL itself), I believe the library (vty?) should expose an API to assign IDs to hyperlinks.
The application, which is the only entity that knows which hyperlink-cells belong to the same URL instance, can then assign an appropriate ID.