Go back to previous mode on rejection of semantic indexing

This commit is contained in:
Piotr Osiewicz 2023-08-09 12:28:15 +02:00
parent d34da2db69
commit 8b033223fb

View File

@ -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(());
}