From 858b15cbca3d818865438ba815507bf17b6cff2b Mon Sep 17 00:00:00 2001 From: Mattias Eriksson Date: Fri, 26 Sep 2025 14:58:10 +0200 Subject: [PATCH] Hide opening hyperlinks behind the Ctrl modifier Hiding hyperlinks behind ctrl is more in line with other terminals, and this avoids opening link when selecting text and so on. --- src/terminal_box.rs | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/terminal_box.rs b/src/terminal_box.rs index be1bb0a..c7e9c6d 100644 --- a/src/terminal_box.rs +++ b/src/terminal_box.rs @@ -1092,16 +1092,19 @@ where let location = terminal .viewport_to_point(TermPoint::new(row as usize, TermColumn(col as usize))); - if let Some(on_open_hyperlink) = &self.on_open_hyperlink { - if let Some(match_) = terminal - .regex_matches - .iter() - .find(|bounds| bounds.contains(&location)) - { - let term = terminal.term.lock(); - let hyperlink = term.bounds_to_string(*match_.start(), *match_.end()); - shell.publish(on_open_hyperlink(hyperlink)); - status = Status::Captured; + if state.modifiers.control() { + if let Some(on_open_hyperlink) = &self.on_open_hyperlink { + if let Some(match_) = terminal + .regex_matches + .iter() + .find(|bounds| bounds.contains(&location)) + { + let term = terminal.term.lock(); + let hyperlink = + term.bounds_to_string(*match_.start(), *match_.end()); + shell.publish(on_open_hyperlink(hyperlink)); + status = Status::Captured; + } } }