diff --git a/crates/fuzzy/src/char_bag.rs b/crates/fuzzy/src/char_bag.rs index e2f68a27d1..c9aab0cd0b 100644 --- a/crates/fuzzy/src/char_bag.rs +++ b/crates/fuzzy/src/char_bag.rs @@ -9,6 +9,7 @@ impl CharBag { } fn insert(&mut self, c: char) { + let c = c.to_ascii_lowercase(); if c >= 'a' && c <= 'z' { let mut count = self.0; let idx = c as u8 - 'a' as u8; diff --git a/crates/fuzzy/src/fuzzy.rs b/crates/fuzzy/src/fuzzy.rs index c9bcdb827f..5f4dbea684 100644 --- a/crates/fuzzy/src/fuzzy.rs +++ b/crates/fuzzy/src/fuzzy.rs @@ -433,13 +433,17 @@ impl<'a> Matcher<'a> { } } - fn find_last_positions(&mut self, prefix: &[char], path: &[char]) -> bool { - let mut path = path.iter(); - let mut prefix_iter = prefix.iter(); - for (i, char) in self.query.iter().enumerate().rev() { - if let Some(j) = path.rposition(|c| c == char) { - self.last_positions[i] = j + prefix.len(); - } else if let Some(j) = prefix_iter.rposition(|c| c == char) { + fn find_last_positions( + &mut self, + lowercase_prefix: &[char], + lowercase_candidate: &[char], + ) -> bool { + let mut lowercase_prefix = lowercase_prefix.iter(); + let mut lowercase_candidate = lowercase_candidate.iter(); + for (i, char) in self.lowercase_query.iter().enumerate().rev() { + if let Some(j) = lowercase_candidate.rposition(|c| c == char) { + self.last_positions[i] = j + lowercase_prefix.len(); + } else if let Some(j) = lowercase_prefix.rposition(|c| c == char) { self.last_positions[i] = j; } else { return false;