file_finder: Fix filename matching to require contiguous characters (#28093)
Improves https://github.com/zed-industries/zed/pull/27937 to only prioritize file name if it's contiguous character match. Release Notes: - N/A Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
parent
03aadb4e5b
commit
10821aae2c
1 changed files with 10 additions and 1 deletions
|
@ -581,7 +581,16 @@ impl Matches {
|
|||
let filename_str = filename.to_string_lossy();
|
||||
|
||||
if let Some(filename_pos) = path_str.rfind(&*filename_str) {
|
||||
return panel_match.0.positions[0] >= filename_pos;
|
||||
if panel_match.0.positions[0] >= filename_pos {
|
||||
let mut prev_position = panel_match.0.positions[0];
|
||||
for p in &panel_match.0.positions[1..] {
|
||||
if *p != prev_position + 1 {
|
||||
return false;
|
||||
}
|
||||
prev_position = *p;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue