-
-
Notifications
You must be signed in to change notification settings - Fork 318
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 hyperlink OSC #468
Conversation
t.TPuts(ti.Hyperlink + style.hyperlink + ti.StringTerminator) | ||
} else if t.curstyle.hyperlink != "" && ti.Hyperlink != "" { | ||
t.TPuts(ti.Hyperlink + ti.StringTerminator) | ||
} |
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.
I am concerned that the style code checks may cause gross inefficiencies -- we have to emit this value when changing the style, and now this string has to be part of that.
This also increases the size of the style -- which might be ok, but I've got some efficiency concerns.
I need to look at this in more depth.
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.
I am concerned that the style code checks may cause gross inefficiencies -- we have to emit this value when changing the style, and now this string has to be part of that.
What do you mean? The new OSC is only emitted when the hyperlink changes -- which should happen exactly as many times as there are hyperlinks on screen. I don't think there's a better way to reduce the number of OSC sequences.
This also increases the size of the style -- which might be ok, but I've got some efficiency concerns.
I don't think this is a big issue -- are there any benchmarks? Do you have any suggestions to improve this?
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.
I'm not sure the statement about when it is emitted is strictly true.
For example, what if part of your link is covered by a different style.
I also want to make sure that the check for style equality still works -- there is definitely code that tries to minimize changing attributes, and I'm not sure what the interaction will be. Mostly I just need to dig into this to be sure this works as intended.
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.
So, what I really want to do is refactor this slightly to use string based capabilities in terminfo. I think that will be a fair bit cleaner. Other than that it looks pretty good.
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.
Alright, thanks for the feedback, I'll look into this.
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.
I'm still not loving the separate begin and end hyperlink bits... but it might be the best approach.
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.
There's also a problem with %s I think (possible conflation with other bits in the terminfo standard.)
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.
I'm still not loving the separate begin and end hyperlink bits... but it might be the best approach.
I don't think there's a way around it. There can be arbitrary escape codes between the start of an hyperlink and its end, including e.g. color changes and other style changes. Having a single escape code for hyperlinks won't cut it.
There's also a problem with %s I think (possible conflation with other bits in the terminfo standard.)
Any suggestions to use something else? Would %v
be better?
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.
In terminfo, %s is the right thing to use here, but technically it should be used with a pop operation. I need to review the code to see the best way to achieve what we want.
Is this new version better? |
Ping @gdamore |
Sorry, I'll have a look at this sometime this week. Been pretty busy with other stuff lately. |
How is it going? I would like to use it in my app. |
FWIW, we've switched to using a fork over at https://github.com/delthas/tcell/tree/dev. |
Oh thanks @emersion, I'll have a look at it. |
I am working on changes inspired by this branch, but there are a few differences.
I should have this out later today. |
Please have a look at #527 which largely builds upon your work, although there are some significant changes. The API is slightly different (see style.Url() instead of style.Hyperlink()) |
I'd like to go ahead and merge that new work, but would like to give folks a chance to comment first. |
I'm closing this for now. Please see the new Url() API which is somewhat derived from this work, but I've made my own changes that I think is truer to the spirit. I'll be adding support for more OSC capabilities soon as well. :-) |
It works great and it's pretty simple and elegant :) thanks |
Closes: #300
Not sure what's the best way to add this to our terminfo.
Tested with foot using this small demo patch: