diff options
author | Christian Duerr <contact@christianduerr.com> | 2023-08-31 02:10:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-31 04:10:17 +0400 |
commit | c83f963eaa185080eb12b5c45223efefe67fc022 (patch) | |
tree | a189fc06ad48a910aad5032769e0d58b6847c1e7 /alacritty_terminal | |
parent | 73276b620782a93bad16a0d5eb7cbd14caf985e6 (diff) | |
download | alacritty-c83f963eaa185080eb12b5c45223efefe67fc022.tar.gz alacritty-c83f963eaa185080eb12b5c45223efefe67fc022.zip |
Fix crash with anchored searches
While this does **not** enable the use of anchors (`^`) in user regexes,
it does prevent Alacritty from crashing when attempting to do so.
Diffstat (limited to 'alacritty_terminal')
-rw-r--r-- | alacritty_terminal/src/term/search.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs index 8f23cfd3..8707de68 100644 --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -7,7 +7,7 @@ use regex_automata::dfa::dense::{Builder, Config, DFA}; use regex_automata::dfa::Automaton; use regex_automata::nfa::thompson::Config as ThompsonConfig; use regex_automata::util::syntax::Config as SyntaxConfig; -use regex_automata::Anchored; +use regex_automata::{Anchored, Input}; use crate::grid::{BidirectionalIterator, Dimensions, GridIterator, Indexed}; use crate::index::{Boundary, Column, Direction, Point, Side}; @@ -215,7 +215,8 @@ impl<T> Term<T> { // Get start state for the DFA. let regex_anchored = if anchored { Anchored::Yes } else { Anchored::No }; - let start_state = regex.universal_start_state(regex_anchored).unwrap(); + let input = Input::new(&[]).anchored(regex_anchored); + let start_state = regex.start_state_forward(&input).unwrap(); let mut state = start_state; let mut iter = self.grid.iter_from(start); |