diff options
author | Christian Duerr <contact@christianduerr.com> | 2021-04-14 01:05:20 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-14 01:05:20 +0000 |
commit | 7f31275e7443667387d9b886c6eeee52c2e29196 (patch) | |
tree | b5049422ab048d80f220ecbd0fe16d9370e9b244 | |
parent | 96fc9ecc9a62c8a766da745d05fbe60e6c2e1efe (diff) | |
download | alacritty-7f31275e7443667387d9b886c6eeee52c2e29196.tar.gz alacritty-7f31275e7443667387d9b886c6eeee52c2e29196.zip |
Fix URL highlight in mouse mode without shift
This resolves a regression introduced in 96fc9ec where URLs would get
highlighted on mouse hover while mouse mode is active even when the
shift modifier was not held down.
-rw-r--r-- | alacritty/src/display/hint.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/alacritty/src/display/hint.rs b/alacritty/src/display/hint.rs index f9ab90d4..6ab68f10 100644 --- a/alacritty/src/display/hint.rs +++ b/alacritty/src/display/hint.rs @@ -5,7 +5,7 @@ use glutin::event::ModifiersState; use alacritty_terminal::grid::BidirectionalIterator; use alacritty_terminal::index::{Boundary, Point}; use alacritty_terminal::term::search::{Match, RegexSearch}; -use alacritty_terminal::term::Term; +use alacritty_terminal::term::{Term, TermMode}; use crate::config::ui_config::{Hint, HintAction}; use crate::config::Config; @@ -246,9 +246,16 @@ pub fn highlighted_at<T>( point: Point, mouse_mods: ModifiersState, ) -> Option<HintMatch> { + let mouse_mode = term.mode().intersects(TermMode::MOUSE_MODE); + config.ui_config.hints.enabled.iter().find_map(|hint| { // Check if all required modifiers are pressed. - if hint.mouse.map_or(true, |mouse| !mouse.enabled || !mouse_mods.contains(mouse.mods.0)) { + let highlight = hint.mouse.map_or(false, |mouse| { + mouse.enabled + && mouse_mods.contains(mouse.mods.0) + && (!mouse_mode || mouse_mods.contains(ModifiersState::SHIFT)) + }); + if !highlight { return None; } |