Support OSC 8 hyperlinks in messages
theViz343 opened this issue ยท 5 comments
With the introduction of the OSC 8 escape sequence, hyperlinks with custom text become possible to display on terminals. It would be useful to implement this in Zulip terminal but urwid does not support it out of the box currently (there is an issue filed regarding it).
An immediate usecase would be in message information popups. Implementing hyperlinks in message information popups will help display clickable long links which span over multiple lines - these links are currently not clickable. Since there is no official urwid support for OSC 8 yet, a possible solution would be to surround the entire text link with the escape sequence.
Whenever urwid does support OSC 8, it might be worthwhile to investigate the use of hyperlinks in the normal message body.
Hello!
I recently developed some urwid widgets that might be useful here. See this Hyperlink
widget.
Feature suggestions and bug reports are gladly welcome.
Thanks.
From the CZO discussion:
One of the challenges is that terminals (emulators) have their own set of supported features, and knowing which set a given one supports can be difficult to detect, like those lists indicate - and that can depend on their internal configuration too.
. . .
Yeah, detecting if the user's terminal is supported is a challenge and currently I'm not aware if there is any particularly good way to do so. An alternative solution may be to allow the user to add OSC 8 hyperlink feature as a launch option (command line/zuliprc).
One good thing about the OSC 8
sequence is that it's non harmful to terminal emulators that lack the feature, provided they recognize and parse OSC
sequences which almost any terminal emulator worthy of being used today does (which includes every terminal emulator and multiplexer I can think of right now).
A terminal emulator that doesn't implement the feature should simply eat up the escape sequences without doing anything (since the DEC Private Mode should be unrecognized) and write out the plain text in-between like nothing ever happened.
Detecting support actually isn't difficult (though involves querying the terminal 1), though in most use cases it's unnecessary because of the reason mentioned above. So, I don't think making it optional is necessary. You may simply keep the current numbered list alongside for the sake of non-supporting terminal emulators.
Footnotes
-
Introduces it's own caveats which aren't a problem as long as the query is performed before starting the urwid screen or expecting any user input โฉ
@AnonymouX47 Thanks for the details - your library looks interesting ๐
The other component to your library looks like it could handle rendering into urwid format from various others - it's a little off-topic on this issue, but I'd be interested to discuss further if you dropped into our stream on chat.zulip.org :)
Thanks for the compliments.
The other component to your library looks like it could handle rendering into urwid format from various others
If you mean parse_text()
, yes.
- it's a little off-topic on this issue, but I'd be interested to discuss further if you dropped into our stream on chat.zulip.org :)
I don't mind... but I don't know what's next after signing up ๐ฅฒ
@AnonymouX47 If you've already signed up:
- If you use the web, the 'CZO discussion' link will take you to the previous conversation
- If you use zulip-terminal, one route is to move the cursor to the #zulip-terminal stream (left panel0, switch the left panel to topics using
t
and useq
to search for the topicHyperlink support using OSC-8 escape sequences
, usingenter
to switch to that topic. - mobile also works :)