Merge pull request #557 from snaggen/ctrl-link

Hide opening hyperlinks behind the Ctrl modifier
This commit is contained in:
Jeremy Soller 2025-09-26 17:26:13 -06:00 • committed by GitHub
commit df7be3fca5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1092,6 +1092,7 @@ where
let location = terminal let location = terminal
.viewport_to_point(TermPoint::new(row as usize, TermColumn(col as usize))); .viewport_to_point(TermPoint::new(row as usize, TermColumn(col as usize)));
if state.modifiers.control() {
if let Some(on_open_hyperlink) = &self.on_open_hyperlink { if let Some(on_open_hyperlink) = &self.on_open_hyperlink {
if let Some(match_) = terminal if let Some(match_) = terminal
.regex_matches .regex_matches
@ -1099,11 +1100,13 @@ where
.find(|bounds| bounds.contains(&location)) .find(|bounds| bounds.contains(&location))
{ {
let term = terminal.term.lock(); let term = terminal.term.lock();
let hyperlink = term.bounds_to_string(*match_.start(), *match_.end()); let hyperlink =
term.bounds_to_string(*match_.start(), *match_.end());
shell.publish(on_open_hyperlink(hyperlink)); shell.publish(on_open_hyperlink(hyperlink));
status = Status::Captured; status = Status::Captured;
} }
} }
}
if is_mouse_mode { if is_mouse_mode {
terminal.report_mouse(event, &state.modifiers, col as u32, row as u32); terminal.report_mouse(event, &state.modifiers, col as u32, row as u32);