From 61bff9c90d8e2a35a7d64ddf0216ab775354bfcf Mon Sep 17 00:00:00 2001 From: Riccardo Mazzarini Date: Sun, 12 Nov 2023 13:40:16 +0100 Subject: [PATCH] fzf: fix typo --- src/algos/fzf/v2.rs | 4 ++-- tests/fzf_v2.rs | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/algos/fzf/v2.rs b/src/algos/fzf/v2.rs index 971bfa6..2eb890e 100644 --- a/src/algos/fzf/v2.rs +++ b/src/algos/fzf/v2.rs @@ -409,8 +409,8 @@ fn score_first_row( let Some((byte_idx, matched_char)) = utils::find_first( query_first_char, candidate, - is_case_sensitive, is_candidate_ascii, + is_case_sensitive, char_eq, ) else { for col in col..scores_first_row.len() { @@ -502,8 +502,8 @@ fn score_remaining_rows( let Some((byte_offset, matched_char)) = utils::find_first( query_char, candidate, - is_case_sensitive, is_candidate_ascii, + is_case_sensitive, char_eq, ) else { for col in column..matrix_width { diff --git a/tests/fzf_v2.rs b/tests/fzf_v2.rs index a83a05b..23b9941 100644 --- a/tests/fzf_v2.rs +++ b/tests/fzf_v2.rs @@ -250,3 +250,17 @@ fn fzf_v2_score_2() { assert!(mach.is_none()); } + +#[test] +fn fzf_v2_score_3() { + let mut fzf = FzfV2::new() + .with_case_sensitivity(CaseSensitivity::Sensitive) + .with_matched_ranges(true); + + let mut parser = FzfParser::new(); + + let mach = + fzf.distance(parser.parse("\0\0"), "\0#B\0\u{364}\0\0").unwrap(); + + assert_eq!(mach.matched_ranges().sorted(), [0..1, 3..4]); +}