1
0
Fork 0
mirror of https://github.com/alacritty/alacritty.git synced 2024-11-11 13:51:01 -05:00

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.
This commit is contained in:
Christian Duerr 2023-08-31 02:10:17 +02:00 committed by GitHub
parent 73276b6207
commit c83f963eaa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);