From 78904186dd9c9150326b2996ebebc4e8914d68d5 Mon Sep 17 00:00:00 2001 From: YoungTaek Date: Sat, 9 May 2026 23:21:03 +0900 Subject: Show focus on active agent in agents panel like spaces panel does (#84) * feat: show focus on active agent in agents panel like spaces panel does * refactor: improve to calculation and binding style --- src/app/state.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/app') diff --git a/src/app/state.rs b/src/app/state.rs index 315872f4..f7c4daa1 100644 --- a/src/app/state.rs +++ b/src/app/state.rs @@ -735,6 +735,29 @@ impl AppState { (24, 80) } } + + /// Returns true when the given (workspace, tab, pane) refers to the + /// currently focused pane in the active workspace's active tab. + pub fn is_active_pane( + &self, + ws_idx: usize, + tab_idx: usize, + pane_id: crate::layout::PaneId, + ) -> bool { + let Some(active_ws_idx) = self.active else { + return false; + }; + if ws_idx != active_ws_idx { + return false; + } + let Some(ws) = self.workspaces.get(ws_idx) else { + return false; + }; + if tab_idx != ws.active_tab_index() { + return false; + } + ws.active_tab().map(|tab| tab.layout.focused()) == Some(pane_id) + } } pub fn key_matches( -- cgit v1.2.3