-
Notifications
You must be signed in to change notification settings - Fork 315
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for hyperlinks in text (OSC8) #391
Comments
Certainly! |
Sorry delayed on this until I find the time to finish off my MR. My current branch is at: lypanov@a6351f6 It fills my need (I have working but weird looking links in alot) but right now it's both a mess and incomplete. |
Any update on this? I see your code and the ansi widget where you've implemented the feature. I tried to implement this for the Toot Mastodon client, and in my first pass I took a different approach; I have a wrapper that can surround text with an OCS 8 escape sequence and turn it into a clickable hyperlink. This is OK for a standalone link, but insufficient for rendering a hyperlink within a block of ordinary text. It'd be ideal to have a new Text widget that includes support for embedding hyperlinks with the OCS 8 sequence. I've tried several different approaches to modify the Text widget and add that feature. Haven't found an elegant way to implement it, yet. |
Sorry for the lack of feedback here. Once my RSI has calmed down I'm hoping to resurrect my merge request which I assume conflicts horribly with the latest version of urwid. I'm unsure what the best approach is alas. The approach I took in the patch set was the most pragmatic route to getting it working for my specific use case. I'm happy there seems to be more interest in OSC 8 at least. I chose Ansi Widget purely because this was the route that alot took for some complex rendering and I based my work upon that. I'll check the status of that work also. |
There's a nice solution in the Urwidgets project by @AnonymouX47 , a |
My Proposition:Add a class like class LinkAttrSpec(uri: str, attr: LinkAttrSpec | Attrspec | str | None = None):
"""Hyperlink display attribute specification.
Args:
- uri: The URI to which the text links.
- attr: A display attribute.
If a `LinkAttrSpec`, its underlying non-hyperlink display attribute is used instead.
""" that should be used just like This new class will be handled in urwid/urwid/display/_raw_display_base.py Line 549 in d7eb3ce
urwid/urwid/display/_raw_display_base.py Line 779 in d7eb3ce
I'm not yet sure whether or not Why not extend
|
An interesting specification to add hyperlinking support directly to terminal emulators has been created, see: https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
I'd like to use this support in a small patch I'm creating for the application alot which uses urwid as it's TUI layer.
I've created a patch for URWID to add such functionality and would love feedback on it. I'll upload the patch to a PR as soon as I've cleaned it up enough for public eyes.
Would you be interested in such a patch?
The text was updated successfully, but these errors were encountered: