diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-04-09 19:05:42 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-04-09 19:05:42 +0300 |
| commit | 065926d9b7933590cb093ef84e591edae356bbec (patch) | |
| tree | b8b5bb5ed08c537b37e25e2676d4e68890edfaa8 | |
| parent | a1345637294db1d3bc31f4baf1f1910d32ef1646 (diff) | |
fix: restore terminal colors on macos after droid exit
| -rw-r--r-- | src/pane.rs | 36 |
1 files changed, 36 insertions, 0 deletions
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<u32> { (!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] |
