-
-
Notifications
You must be signed in to change notification settings - Fork 277
Use Hyperlink widget for links in message info popup. #1409
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
base: main
Are you sure you want to change the base?
Conversation
075b24a
to
c84a22f
Compare
Hey @theViz343 ,I am getting the error
|
@Subhasish-Behera If you're using @theViz343 It would be useful to have the dependency change visible as a separate small commit, as we do when we change other |
This commit adds the urwidgets library for including hyperlink support in ZT using the OSC-8 escape sequence.
This commit introduces the use of the Hyperlink widget from the Urwidgets library for displaying links in the message information popup.
c84a22f
to
e0e778c
Compare
icon = urwid.Pile( | ||
widget_list=[ | ||
urwid.SelectableIcon(caption, cursor_position=len(caption) + 1), | ||
urwidgets.Hyperlink(uri=self.link), | ||
] | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having the rendering of the link defined in the link button like this would be cleaner, and it may be reasonable to refactor the layout into the button as a prep refactor for this.
However, right now this overall change affects the rendering quite a lot: links are not styled in the same way as the background of the button, or when selected. That makes it difficult to visually identify that the link and number/title are related to the link when many links are present.
I'm not sure if that's a limitation of the Hyperlink?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello!
However, right now this overall change affects the rendering quite a lot: links are not styled in the same way as the background of the button, or when selected. That makes it difficult to visually identify that the link and number/title are related to the link when many links are present.
I'm not sure if that's a limitation of the Hyperlink?
Yes, it was.
I just released v0.2.0 which allows the use of Attrmap
s (and other means) over Hyperlink
widgets (and the rendered canvases). See AnonymouX47/urwidgets#3.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace with:
hyperlink = urwidgets.Hyperlink(uri=self.link)
icon = urwid.Pile(
widget_list=[
urwid.SelectableIcon(caption, cursor_position=len(caption) + 1),
# using `hyperlink.pack()[0]` instead of `len(self.link)` in case of wide characters
urwidgets.TextEmbed((hyperlink.pack()[0], hyperlink)),
]
)
to wrap the URL across lines instead of clipping with ellipsis.
The OSC 8
feature will still work perfectly on any terminal emulator with a spec-compliant implementation and behaviour will remain the same as before this PR on terminal emulators that don't support the feature.
What does this PR do, and why?
This PR introduces the Hyperlink widget for message links in message information popups. This solves the issue of long urls being force-wrapped which results in them not being clickable from ZT.
Outstanding aspect(s)
External discussion & connections
Hyperlink support using OSC-8 escape sequences
How did you test this?
Self-review checklist for each commit
Visual changes