mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-12 21:32:40 +00:00
Use only lowercase characters to determine if query matches a candidate
This commit is contained in:
parent
d6ed2ba642
commit
5f2ac61401
2 changed files with 12 additions and 7 deletions
|
@ -9,6 +9,7 @@ impl CharBag {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn insert(&mut self, c: char) {
|
fn insert(&mut self, c: char) {
|
||||||
|
let c = c.to_ascii_lowercase();
|
||||||
if c >= 'a' && c <= 'z' {
|
if c >= 'a' && c <= 'z' {
|
||||||
let mut count = self.0;
|
let mut count = self.0;
|
||||||
let idx = c as u8 - 'a' as u8;
|
let idx = c as u8 - 'a' as u8;
|
||||||
|
|
|
@ -433,13 +433,17 @@ impl<'a> Matcher<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn find_last_positions(&mut self, prefix: &[char], path: &[char]) -> bool {
|
fn find_last_positions(
|
||||||
let mut path = path.iter();
|
&mut self,
|
||||||
let mut prefix_iter = prefix.iter();
|
lowercase_prefix: &[char],
|
||||||
for (i, char) in self.query.iter().enumerate().rev() {
|
lowercase_candidate: &[char],
|
||||||
if let Some(j) = path.rposition(|c| c == char) {
|
) -> bool {
|
||||||
self.last_positions[i] = j + prefix.len();
|
let mut lowercase_prefix = lowercase_prefix.iter();
|
||||||
} else if let Some(j) = prefix_iter.rposition(|c| c == char) {
|
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;
|
self.last_positions[i] = j;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue