fix: retain terminal keyboard focus
CI / rust (push) Successful in 2m1s

This commit is contained in:
2026-08-31 17:26:38 -07:00
parent 52b210df43
commit 46cf116812
+7 -4
View File
@@ -345,7 +345,7 @@ impl LumbridgeShell {
.tab_stop(true) .tab_stop(true)
}); });
let root_focus = cx.focus_handle(); let root_focus = cx.focus_handle();
window.focus(&pane_focus[0]); window.focus(&root_focus);
cx.spawn(async move |this, cx| { cx.spawn(async move |this, cx| {
loop { loop {
@@ -529,7 +529,7 @@ impl LumbridgeShell {
fn select_pane(&mut self, pane: PaneId, window: &mut Window, cx: &mut Context<Self>) { fn select_pane(&mut self, pane: PaneId, window: &mut Window, cx: &mut Context<Self>) {
self.dispatch(ShellAction::SelectPane(pane)); self.dispatch(ShellAction::SelectPane(pane));
window.focus(&self.pane_focus[pane.index()]); window.focus(&self.root_focus);
cx.notify(); cx.notify();
} }
@@ -539,8 +539,8 @@ impl LumbridgeShell {
window: &mut Window, window: &mut Window,
cx: &mut Context<Self>, cx: &mut Context<Self>,
) { ) {
let outcome = self.dispatch(ShellAction::MoveFocus(direction)); self.dispatch(ShellAction::MoveFocus(direction));
window.focus(&self.pane_focus[outcome.selected_pane.index()]); window.focus(&self.root_focus);
cx.notify(); cx.notify();
} }
@@ -1339,6 +1339,9 @@ impl Render for LumbridgeShell {
.relative() .relative()
.track_focus(&self.root_focus) .track_focus(&self.root_focus)
.key_context("LumbridgeShell") .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_left))
.on_action(cx.listener(Self::focus_right)) .on_action(cx.listener(Self::focus_right))
.on_action(cx.listener(Self::focus_up)) .on_action(cx.listener(Self::focus_up))