From 8b033223fb407de5b3a96fea77d76e62de9bc54a Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Wed, 9 Aug 2023 12:28:15 +0200 Subject: [PATCH] Go back to previous mode on rejection of semantic indexing --- crates/search/src/project_search.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/search/src/project_search.rs b/crates/search/src/project_search.rs index 8939279f3b230f050cc912d5a41788cf10cda1c8..be40f6ca15c2de109630568f7792d3f616e8f35f 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) { + 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(()); }