-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Description
Ghostty should support OSC8 Hyperlinks
Some general implementation considerations and thoughts that go beyond the reference:
- Links are generally rare. A look aside table would be appropriate, with each cell requiring only an index into that
ArrayList
. This could probably be a u8 - Hyperlinks should be defined per-screen. I believe we can clear the hyperlink storage when exiting the alt screen. The primary screen should retain the list of hyperlinks for the life of the screen (any old link could be scrolled into and require us to know the ID and target)
- My preference would be that OSC hyperlinks always show a dotted underline, and on hover show the normal hover underline. This would be unique to Ghostty but IMO is a huge benefit. In other terminals, applications need to style these cells separately on their own (and basically none of them do), leaving users with no idea when a hyperlink is present
- Given that hyperlinks are rare and to keep the per-cell byte count low, the index value should be as small as possible, considering alignment. u8 seems appropriate but given the lifetime of some primary screens may be too small.
- The cursor also needs an OSC 8 field. The OSC8 sequence is in effect for any cell the cursor paints, meaning after the OSC 8 opener we add this as an effective "attribute" to the cursor. For example, this is valid and works in terminals which support OSC 8:
printf '\x1B[3;3H\x1B]8;;https://example.org\x1B\\Hyperlink Text\x1B[HMore, non-consecutive text\x1B]8;;\x1B\\
jcollie, stgarf, carloscabanero, ferdinandyb, martino and 1 more
Metadata
Metadata
Assignees
Labels
No labels