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