diff --git a/src/pane.rs b/src/pane.rs index 69a37309..1438d65e 100644 --- a/src/pane.rs +++ b/src/pane.rs @@ -385,6 +385,26 @@ fn current_transient_default_color_owner(shell_pid: u32) -> Option { (!foreground_job_is_shell(&job, shell_pid)).then_some(job.process_group_id) } +#[cfg(target_os = "macos")] +fn should_restore_host_terminal_theme( + owner_pgid: u32, + shell_pid: u32, + alternate_screen: bool, + foreground_job: Option<&crate::platform::ForegroundJob>, +) -> bool { + if alternate_screen { + return false; + } + + let Some(foreground_job) = foreground_job else { + return false; + }; + + let _ = owner_pgid; + foreground_job_is_shell(foreground_job, shell_pid) +} + +#[cfg(not(target_os = "macos"))] fn should_restore_host_terminal_theme( owner_pgid: u32, shell_pid: u32, @@ -2516,6 +2536,22 @@ mod tests { false, Some(&shell_job(7)), )); + + #[cfg(target_os = "macos")] + assert!(should_restore_host_terminal_theme( + 7, + 7, + false, + Some(&shell_job(7)), + )); + + #[cfg(not(target_os = "macos"))] + assert!(!should_restore_host_terminal_theme( + 7, + 7, + false, + Some(&shell_job(7)), + )); } #[test]