From 065926d9b7933590cb093ef84e591edae356bbec Mon Sep 17 00:00:00 2001 From: Ogulcan Celik Date: Thu, 9 Apr 2026 19:05:42 +0300 Subject: [PATCH] fix: restore terminal colors on macos after droid exit --- src/pane.rs | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) 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]