diff --git a/src/algos/fzf/v1.rs b/src/algos/fzf/v1.rs index 113b22d..b142a33 100644 --- a/src/algos/fzf/v1.rs +++ b/src/algos/fzf/v1.rs @@ -278,14 +278,14 @@ fn backward_pass( ) -> usize { // The candidate must start with the first character of the query. debug_assert!(char_eq( + pattern.chars().next().unwrap(), candidate.chars().next().unwrap(), - pattern.chars().next().unwrap() )); // The candidate must end with the last character of the query. debug_assert!(char_eq( + pattern.chars().next_back().unwrap(), candidate.chars().next_back().unwrap(), - pattern.chars().next_back().unwrap() )); let mut pattern_chars = pattern.chars().rev(); diff --git a/tests/fzf_v1.rs b/tests/fzf_v1.rs index b661b4d..1fe2c91 100644 --- a/tests/fzf_v1.rs +++ b/tests/fzf_v1.rs @@ -271,3 +271,17 @@ fn fzf_v1_score_4() { assert_eq!(mach.matched_ranges(), [1..2, 21..22]); } + +#[test] +fn fzf_v1_score_5() { + let mut fzf = FzfV1::new() + .with_case_sensitivity(CaseSensitivity::Sensitive) + .with_matched_ranges(true) + .with_normalization(true); + + let mut parser = FzfParser::new(); + + let mach = fzf.distance(parser.parse("e !"), " !I\\hh+\u{364}").unwrap(); + + assert_eq!(mach.matched_ranges(), [1..2, 7..9]); +}