You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I have a program where I want to render clickable hyperlinks as specified by OSC 8, cursive has no native way to render OSC8, and going around cursive for it is a major hassle and not something advisable.
Describe the solution you'd like
A way to specify a hyperlink in cursive, potentially the api could look like this (modeled after the with_* Printer methods):
implPrinter{/// Wraps the printed text with a hyperlinkpubfnwith_hyperlink<F:FnOnce(&Printer)>(&self,link:&str,f:F);}
and other related methods like set_hyperlink, though this seems weird to set/unset
Alternatively, OSC8 provides a way to label hyperlinks as the same with the id parameter, so the api could look like this (and set_hyperlink would make more sense):
#[derive(Copy,Clone)]structHyperlink<'a>{link:&'a str,// this can be a stable hash of the link, or user provided, or just random,// whatever works best for cursive// OSC8 intends id's to be used for applications where you have// hyperlinks split over multiple lines, the id will uniquely // identify separate segments as one link// the length of 8 was arbitrarily chosen for demonstrationid:[u8;8],}impl<'a>Hyperlink<'a>{// using rand here as an example, in this way each new Hyperlink is probabilistically distinctfnnew(link:&'a str) -> Self{Self{ link,id: rand::thread_rng().gen()}}}implPrinter{/// Wraps the printed text with a hyperlinkpubfnwith_hyperlink<F:FnOnce(&Printer)>(&self,link:Hyperlink,f:F);}
Additional context
While cursive View's can be used to replicate a portion of the OSC8 hyperlink behavior, this is an API that modern terminal emulators provide, and it would be cool if cursive could support rendering them
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
I have a program where I want to render clickable hyperlinks as specified by OSC 8, cursive has no native way to render OSC8, and going around cursive for it is a major hassle and not something advisable.
OSC 8 described
Describe the solution you'd like
A way to specify a hyperlink in cursive, potentially the api could look like this (modeled after the with_* Printer methods):
and other related methods like set_hyperlink, though this seems weird to set/unset
Alternatively, OSC8 provides a way to label hyperlinks as the same with the
id
parameter, so the api could look like this (and set_hyperlink would make more sense):Additional context
While cursive View's can be used to replicate a portion of the OSC8 hyperlink behavior, this is an API that modern terminal emulators provide, and it would be cool if cursive could support rendering them
The text was updated successfully, but these errors were encountered: