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.

Use WHOLE_WORD search option in vim mode's whole-word search (#18725)

Ömer Sinan Ağacan71f4ca67c236
diff --git a/crates/vim/src/normal/search.rs b/crates/vim/src/normal/search.rs
index 519606b0e5d..6769238407e 100644
--- a/crates/vim/src/normal/search.rs
+++ b/crates/vim/src/normal/search.rs
@@ -269,6 +269,9 @@ impl Vim {
if regex {
options |= SearchOptions::REGEX;
}
+ if whole_word {
+ options |= SearchOptions::WHOLE_WORD;
+ }
if !search_bar.show(cx) {
return None;
}
@@ -276,10 +279,7 @@ impl Vim {
drop(search_bar.search("", None, cx));
return None;
};
- let mut query = regex::escape(&query);
- if whole_word {
- query = format!(r"\<{}\>", query);
- }
+ let query = regex::escape(&query);
Some(search_bar.search(&query, Some(options), cx))
});