fix: restore terminal colors on macos after droid exit
This commit is contained in:
parent
a134563729
commit
065926d9b7
36
src/pane.rs
36
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]
|
||||
|
|
|
|||
Loading…
Reference in New Issue