Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Go back to previous mode on rejection of semantic indexing
Piotr Osiewicz8b033223fb40
diff --git a/crates/search/src/project_search.rs b/crates/search/src/project_search.rsindex 8939279f3b2..be40f6ca15c 100644--- a/crates/search/src/project_search.rs+++ b/crates/search/src/project_search.rs@@ -685,6 +685,10 @@ impl ProjectSearchView {}fn activate_search_mode(&mut self, mode: SearchMode, cx: &mut ViewContext<Self>) {+ let previous_mode = self.current_mode;+ if previous_mode == mode {+ return;+ }self.model.update(cx, |model, _| model.kill_search());self.current_mode = mode;@@ -722,7 +726,8 @@ impl ProjectSearchView {} else {this.update(&mut cx, |this, cx| {this.semantic_permissioned = Some(false);- this.activate_search_mode(SearchMode::Regex, cx);+ debug_assert_ne!(previous_mode, SearchMode::Semantic, "Tried to re-enable semantic search mode after user modal was rejected");+ this.activate_search_mode(previous_mode, cx);})?;return anyhow::Ok(());}