summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2021-04-30 00:23:09 +0000
committerGitHub <noreply@github.com>2021-04-30 00:23:09 +0000
commitedf0faf98fe69d79bdc4798fb574a46d9956156a (patch)
tree6e3c867971f7dbdd5beb1de73d116b1a81434d42
parent4d982894a6859b6d4eeb967ec6dbbf5965c79165 (diff)
downloadalacritty-edf0faf98fe69d79bdc4798fb574a46d9956156a.tar.gz
alacritty-edf0faf98fe69d79bdc4798fb574a46d9956156a.zip
Fix highlighting multiple hints in the same line
Fixes #5010.
-rw-r--r--alacritty/src/display/hint.rs11
1 files changed, 6 insertions, 5 deletions
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<T>(
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 {