aboutsummaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
authorYoungTaek <soomtong@gmail.com>2026-05-09 23:21:03 +0900
committerGitHub <noreply@github.com>2026-05-09 17:21:03 +0300
commit78904186dd9c9150326b2996ebebc4e8914d68d5 (patch)
tree93bc01394326b97ef934094d34743c94839aa408 /src/app
parentdb2360f8f80d46e98e88b8649e0f2cd8a8cdbd57 (diff)
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
Diffstat (limited to 'src/app')
-rw-r--r--src/app/state.rs23
1 files changed, 23 insertions, 0 deletions
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(