From 46cf116812e8c3d3ac71b3c7287a2d9b25911930 Mon Sep 17 00:00:00 2001 From: Kartios Date: Mon, 31 Aug 2026 17:26:38 -0700 Subject: [PATCH] fix: retain terminal keyboard focus --- spikes/gpui-shell/src/main.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/spikes/gpui-shell/src/main.rs b/spikes/gpui-shell/src/main.rs index 431946a..9dfa0c5 100644 --- a/spikes/gpui-shell/src/main.rs +++ b/spikes/gpui-shell/src/main.rs @@ -345,7 +345,7 @@ impl LumbridgeShell { .tab_stop(true) }); let root_focus = cx.focus_handle(); - window.focus(&pane_focus[0]); + window.focus(&root_focus); cx.spawn(async move |this, cx| { loop { @@ -529,7 +529,7 @@ impl LumbridgeShell { fn select_pane(&mut self, pane: PaneId, window: &mut Window, cx: &mut Context) { self.dispatch(ShellAction::SelectPane(pane)); - window.focus(&self.pane_focus[pane.index()]); + window.focus(&self.root_focus); cx.notify(); } @@ -539,8 +539,8 @@ impl LumbridgeShell { window: &mut Window, cx: &mut Context, ) { - let outcome = self.dispatch(ShellAction::MoveFocus(direction)); - window.focus(&self.pane_focus[outcome.selected_pane.index()]); + self.dispatch(ShellAction::MoveFocus(direction)); + window.focus(&self.root_focus); cx.notify(); } @@ -1339,6 +1339,9 @@ impl Render for LumbridgeShell { .relative() .track_focus(&self.root_focus) .key_context("LumbridgeShell") + .on_click(cx.listener(|shell, _, window, _| { + window.focus(&shell.root_focus); + })) .on_action(cx.listener(Self::focus_left)) .on_action(cx.listener(Self::focus_right)) .on_action(cx.listener(Self::focus_up))