forked from NotAShelf/beer
render: OSC 8 hyperlinks with hover/click and a URL hint mode
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I7b39adae426d3fc5b7dfe1437eb10e976a6a6964
This commit is contained in:
parent
72ec651ff1
commit
2161d7250f
6 changed files with 457 additions and 11 deletions
11
src/vt.rs
11
src/vt.rs
|
|
@ -680,6 +680,17 @@ impl Perform for Term {
|
|||
self.grid.set_prompt_mark(kind);
|
||||
}
|
||||
}
|
||||
// OSC 8: hyperlink. `OSC 8 ; params ; URI ST`; an empty URI ends the
|
||||
// link. The URI is everything after the second field, rejoined since
|
||||
// a URI may itself contain ';'.
|
||||
Some(&n) if n == b"8" => {
|
||||
let uri_bytes = params
|
||||
.get(2..)
|
||||
.map(|parts| parts.join(&b';'))
|
||||
.unwrap_or_default();
|
||||
let uri = std::str::from_utf8(&uri_bytes).unwrap_or("");
|
||||
self.grid.set_link((!uri.is_empty()).then_some(uri));
|
||||
}
|
||||
// OSC 4: set/query palette entries (pairs of index;spec).
|
||||
Some(&n) if n == b"4" => self.osc_palette(params, bell),
|
||||
// OSC 104: reset palette (all, or the listed indices).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue