rust-ansi-term
rust-ansi-term copied to clipboard
Add hyperlink support
Some terminals support hyperlinks to URLs as a text style, defined at https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda .
Add support for these escape sequences to ansi_term, storing the
hyperlink target as an Option<Rc
This makes Style no longer Copy, so Style now requires .clone() when duplicating it.
Note that this intentionally omits support for the id
attribute, used
by screen-oriented applications to group separated links together as
"the same link". This arises when splitting links across lines within a
windowing or window-splitting mechanism. Applications with such use
cases will need other screen-oriented escape sequences that ansi_term
doesn't cover, as well.
The implementation as written uses Option::as_deref
, which was stabilized in Rust 1.40. If that's a problem, I can avoid it.
Other than Copy
, another breaking change here is that the Rc
makes it non-Sync
. (And this is kind of a bad situation… e.g. exa
needs it to be Sync
, but anyone else who's not using threads might not want the overhead of having an Arc
in there)