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.

Give correct focus handle when project search has no matches

Juliade523c2d8063
diff --git a/crates/gpui2/src/window.rs b/crates/gpui2/src/window.rs
index e2f53f73472..1c0849785b6 100644
--- a/crates/gpui2/src/window.rs
+++ b/crates/gpui2/src/window.rs
@@ -489,7 +489,6 @@ impl<'a> WindowContext<'a> {
#[cfg(any(test, feature = "test-support"))]
{
- println!("invalidating focus");
self.window.focus_invalidated = true;
}
diff --git a/crates/search2/src/project_search.rs b/crates/search2/src/project_search.rs
index da48625b429..167c6fece28 100644
--- a/crates/search2/src/project_search.rs
+++ b/crates/search2/src/project_search.rs
@@ -378,7 +378,11 @@ impl Render for ProjectSearchView {
impl FocusableView for ProjectSearchView {
fn focus_handle(&self, cx: &AppContext) -> gpui::FocusHandle {
- self.results_editor.focus_handle(cx)
+ if self.has_matches() {
+ self.results_editor.focus_handle(cx)
+ } else {
+ self.query_editor.focus_handle(cx)
+ }
}
}