handle osc 8 links
This commit is contained in:
parent
88438642a6
commit
3b33087086
2 changed files with 82 additions and 6 deletions
|
|
@ -246,6 +246,7 @@ pub struct Terminal {
|
|||
pub url_regex_search: RegexSearch,
|
||||
pub regex_matches: Vec<alacritty_terminal::term::search::Match>,
|
||||
pub active_regex_match: Option<alacritty_terminal::term::search::Match>,
|
||||
pub active_hyperlink_id: Option<String>,
|
||||
bold_font_weight: Weight,
|
||||
buffer: Arc<Buffer>,
|
||||
is_focused: bool,
|
||||
|
|
@ -335,6 +336,7 @@ impl Terminal {
|
|||
|
||||
Ok(Self {
|
||||
active_regex_match: None,
|
||||
active_hyperlink_id: None,
|
||||
url_regex_search: url_regex_search(),
|
||||
regex_matches: Vec::new(),
|
||||
bold_font_weight: Weight(bold_font_weight),
|
||||
|
|
@ -887,6 +889,28 @@ impl Terminal {
|
|||
flags |= Flags::UNDERLINE;
|
||||
}
|
||||
}
|
||||
if let Some(active_id) = &self.active_hyperlink_id {
|
||||
let mut matches_active = indexed
|
||||
.cell
|
||||
.hyperlink()
|
||||
.is_some_and(|link| link.id() == active_id);
|
||||
if !matches_active
|
||||
&& indexed.cell.flags.intersects(
|
||||
Flags::WIDE_CHAR_SPACER | Flags::LEADING_WIDE_CHAR_SPACER,
|
||||
)
|
||||
&& indexed.point.column.0 > 0
|
||||
{
|
||||
matches_active = grid[Point::new(
|
||||
indexed.point.line,
|
||||
Column(indexed.point.column.0 - 1),
|
||||
)]
|
||||
.hyperlink()
|
||||
.is_some_and(|link| link.id() == active_id);
|
||||
}
|
||||
if matches_active {
|
||||
flags |= Flags::UNDERLINE;
|
||||
}
|
||||
}
|
||||
|
||||
let metadata = Metadata::new(bg, fg)
|
||||
.with_flags(flags)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue