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.

buffer_search: Fix DeployReplace not working when buffer search is already deployed (#29066)

Smit Barmase65a7076ba89e
diff --git a/crates/search/src/buffer_search.rs b/crates/search/src/buffer_search.rs
index 097e49ee75a..12b9ed53497 100644
--- a/crates/search/src/buffer_search.rs
+++ b/crates/search/src/buffer_search.rs
@@ -657,6 +657,16 @@ impl BufferSearchBar {
registrar.register_handler(ForDeployed(|this, deploy, window, cx| {
this.deploy(deploy, window, cx);
}));
+ registrar.register_handler(ForDismissed(|this, deploy, window, cx| {
+ this.deploy(deploy, window, cx);
+ }));
+ registrar.register_handler(ForDeployed(|this, _: &DeployReplace, window, cx| {
+ if this.supported_options(cx).find_in_results {
+ cx.propagate();
+ } else {
+ this.deploy(&Deploy::replace(), window, cx);
+ }
+ }));
registrar.register_handler(ForDismissed(|this, _: &DeployReplace, window, cx| {
if this.supported_options(cx).find_in_results {
cx.propagate();
@@ -664,9 +674,6 @@ impl BufferSearchBar {
this.deploy(&Deploy::replace(), window, cx);
}
}));
- registrar.register_handler(ForDismissed(|this, deploy, window, cx| {
- this.deploy(deploy, window, cx);
- }))
}
pub fn new(