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.

component preview: Focus search input immediately upon opening (#29155)

Danilo Leal9a3434efb406
diff --git a/crates/component_preview/src/component_preview.rs b/crates/component_preview/src/component_preview.rs
index 276271828e5..74105a0213a 100644
--- a/crates/component_preview/src/component_preview.rs
+++ b/crates/component_preview/src/component_preview.rs
@@ -166,6 +166,9 @@ impl ComponentPreview {
component_preview.update_component_list(cx);
+ let focus_handle = component_preview.filter_editor.read(cx).focus_handle(cx);
+ window.focus(&focus_handle);
+
component_preview
}
@@ -779,10 +782,13 @@ impl Item for ComponentPreview {
fn added_to_workspace(
&mut self,
workspace: &mut Workspace,
- _window: &mut Window,
- _cx: &mut Context<Self>,
+ window: &mut Window,
+ cx: &mut Context<Self>,
) {
self.workspace_id = workspace.database_id();
+
+ let focus_handle = self.filter_editor.read(cx).focus_handle(cx);
+ window.focus(&focus_handle);
}
}