aboutsummaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
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(