Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

settings_ui: Match all query words in search (#56835)

Kunall Banerjeeb224588d440f
diff --git a/crates/settings_ui/src/settings_ui.rs b/crates/settings_ui/src/settings_ui.rs
index fcc3cbecc85..f8d938e9eec 100644
--- a/crates/settings_ui/src/settings_ui.rs
+++ b/crates/settings_ui/src/settings_ui.rs
@@ -1982,11 +1982,14 @@ impl SettingsWindow {
async move {
let query_lower = query.to_lowercase();
let query_words: Vec<&str> = query_lower.split_whitespace().collect();
+ if query_words.is_empty() {
+ return Vec::new();
+ }
search_index
.documents
.iter()
.filter(|doc| {
- query_words.iter().any(|query_word| {
+ query_words.iter().all(|query_word| {
doc.words
.iter()
.any(|doc_word| doc_word.starts_with(query_word))