Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Add workspace::FocusCenterPane (#46059)
Josh P.695e8a929bce
diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rsindex 1e9358b80b8..0dfd5b2a1c1 100644--- a/crates/workspace/src/workspace.rs+++ b/crates/workspace/src/workspace.rs@@ -399,7 +399,12 @@ pub struct Save {pub save_intent: Option<SaveIntent>,}-/// Closes all items and panes in the workspace.+/// Moves Focus to the central panes in the workspace.+#[derive(Clone, Debug, PartialEq, Eq, Action)]+#[action(namespace = workspace)]+pub struct FocusCenterPane;++/// Closes all items and panes in the workspace.#[derive(Clone, PartialEq, Debug, Deserialize, Default, JsonSchema, Action)]#[action(namespace = workspace)]#[serde(deny_unknown_fields)]@@ -3824,6 +3829,14 @@ impl Workspace {did_focus_panel}+ pub fn focus_center_pane(&mut self, window: &mut Window, cx: &mut Context<Self>) {+ if let Some(item) = self.active_item(cx) {+ item.item_focus_handle(cx).focus(window, cx);+ } else {+ log::error!("Could not find a focus target when switching focus to the center panes",);+ }+ }+pub fn activate_panel_for_proto_id(&mut self,panel_id: PanelId,@@ -6852,6 +6865,9 @@ impl Workspace {}}),)+ .on_action(cx.listener(|workspace, _: &FocusCenterPane, window, cx| {+ workspace.focus_center_pane(window, cx);+ })).on_action(cx.listener(Workspace::cancel))}