Harden progress cursor selection

This commit is contained in:
Dave Aitel
2026-02-06 13:30:52 -05:00
parent 0d24339e75
commit 52b08e3106
2 changed files with 11 additions and 2 deletions
@@ -971,8 +971,8 @@ impl EventProcessorWithHumanOutput {
return;
}
let mut output = String::new();
output.push('\r');
output.push_str("\u{1b}[2K");
output.push_str("\u{1b}[0G");
output.push_str(&line);
if done {
eprintln!("{output}");
+10 -1
View File
@@ -129,7 +129,16 @@ pub async fn run_main(cli: Cli, codex_linux_sandbox_exe: Option<PathBuf>) -> any
match color {
cli::Color::Never => false,
cli::Color::Always => true,
cli::Color::Auto => stderr_with_ansi || std::io::stderr().is_terminal(),
cli::Color::Auto => {
if stderr_with_ansi || std::io::stderr().is_terminal() {
true
} else {
match std::env::var("TERM") {
Ok(term) => !term.is_empty() && term != "dumb",
Err(_) => false,
}
}
}
}
};