Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
file_finder: Fix filename matching to require contiguous characters (#28093)
Smit Barmase10821aae2c12
diff --git a/crates/file_finder/src/file_finder.rs b/crates/file_finder/src/file_finder.rsindex 1a74c4e4bb8..7a54475cc02 100644--- a/crates/file_finder/src/file_finder.rs+++ b/crates/file_finder/src/file_finder.rs@@ -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;+ }}}