From c4203868ea101f3232901aaa554e22dfa0461816 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 14 Apr 2022 07:53:15 -0600 Subject: [PATCH] Revert "Focus Project Search query editor always when deployed" --- crates/search/src/project_search.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/search/src/project_search.rs b/crates/search/src/project_search.rs index 7ed4e802b3..7d11fcbea5 100644 --- a/crates/search/src/project_search.rs +++ b/crates/search/src/project_search.rs @@ -170,7 +170,11 @@ impl View for ProjectSearchView { .insert(self.model.read(cx).project.downgrade(), handle) }); - self.focus_query_editor(cx); + if self.model.read(cx).match_ranges.is_empty() { + cx.focus(&self.query_editor); + } else { + self.focus_results_editor(cx); + } } } @@ -394,7 +398,6 @@ impl ProjectSearchView { if let Some(existing) = existing { workspace.activate_item(&existing, cx); - existing.update(cx, |existing, cx| existing.focus_query_editor(cx)); } else { let model = cx.add_model(|cx| ProjectSearch::new(workspace.project().clone(), cx)); workspace.add_item(