diff options
Diffstat (limited to 'src/app/state.rs')
| -rw-r--r-- | src/app/state.rs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/app/state.rs b/src/app/state.rs index 494bee0f..32cf087d 100644 --- a/src/app/state.rs +++ b/src/app/state.rs @@ -1419,6 +1419,22 @@ impl AppState { self.switch_ascii_input_source_in_prefix } + pub(crate) fn pane_exposes_host_cursor( + &self, + ws_idx: usize, + pane_id: crate::layout::PaneId, + ) -> bool { + let has_effective_agent_label = self + .workspaces + .get(ws_idx) + .and_then(|ws| ws.terminal_id(pane_id)) + .and_then(|terminal_id| self.terminals.get(terminal_id)) + .and_then(crate::terminal::TerminalState::effective_agent_label) + .is_some(); + + pane_exposes_host_cursor_for_target(has_effective_agent_label, cfg!(windows)) + } + pub(crate) fn integration_updates_available(&self) -> bool { self.integration_recommendations .iter() @@ -1734,12 +1750,31 @@ impl AppState { } } +fn pane_exposes_host_cursor_for_target( + has_effective_agent_label: bool, + target_is_windows: bool, +) -> bool { + !target_is_windows || !has_effective_agent_label +} + #[cfg(test)] mod tests { use super::*; use crossterm::event::KeyEvent; #[test] + fn windows_agent_panes_do_not_expose_host_cursor() { + assert!(!pane_exposes_host_cursor_for_target(true, true)); + assert!(pane_exposes_host_cursor_for_target(false, true)); + } + + #[test] + fn non_windows_agent_panes_keep_existing_host_cursor_behavior() { + assert!(pane_exposes_host_cursor_for_target(true, false)); + assert!(pane_exposes_host_cursor_for_target(false, false)); + } + + #[test] fn built_in_theme_names_resolve() { for name in THEME_NAMES { assert!( |
