diff --git a/alacritty/src/display/hint.rs b/alacritty/src/display/hint.rs index f2f49b5d..76eb4b95 100644 --- a/alacritty/src/display/hint.rs +++ b/alacritty/src/display/hint.rs @@ -3,8 +3,8 @@ use std::cmp::{max, min}; 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::index::{Boundary, Direction, Point}; +use alacritty_terminal::term::search::{Match, RegexIter, RegexSearch}; use alacritty_terminal::term::{Term, TermMode}; use crate::config::ui_config::{Hint, HintAction}; @@ -266,11 +266,12 @@ pub fn highlighted_at( let mut end = term.line_search_right(point); end.line = min(end.line, point.line + MAX_SEARCH_LINES); - // Function to verify if the specified point is inside the match. - let at_point = |rm: &Match| *rm.start() <= point && *rm.end() >= point; + // Function to verify that the specified point is inside the match. + let at_point = |rm: &Match| *rm.end() >= point && *rm.start() <= point; // Check if there's any match at the specified point. - let regex_match = term.regex_search_right(regex, start, end).filter(at_point)?; + let mut iter = RegexIter::new(start, end, Direction::Right, term, regex); + let regex_match = iter.find(at_point)?; // Apply post-processing and search for sub-matches if necessary. let regex_match = if hint.post_processing {