From 21720645565fe619714afa0169528d18492b5143 Mon Sep 17 00:00:00 2001 From: Dave Aitel Date: Fri, 6 Feb 2026 13:34:52 -0500 Subject: [PATCH] Update progress line via cursor-up --- .../src/event_processor_with_human_output.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/codex-rs/exec/src/event_processor_with_human_output.rs b/codex-rs/exec/src/event_processor_with_human_output.rs index 544a42381c..c4603ffa21 100644 --- a/codex-rs/exec/src/event_processor_with_human_output.rs +++ b/codex-rs/exec/src/event_processor_with_human_output.rs @@ -931,9 +931,11 @@ impl EventProcessorWithHumanOutput { fn finish_progress_line(&mut self) { if self.progress_active { - eprintln!(); self.progress_active = false; self.progress_last_len = 0; + if !self.use_ansi_cursor { + eprintln!(); + } } } @@ -970,18 +972,16 @@ impl EventProcessorWithHumanOutput { } return; } - let mut output = String::new(); - output.push('\r'); - output.push_str("\u{1b}[2K"); - output.push_str(&line); + if self.progress_active { + eprint!("\u{1b}[1A\u{1b}[2K"); + } + eprintln!("{line}"); + let _ = std::io::stderr().flush(); if done { - eprintln!("{output}"); self.progress_active = false; self.progress_last_len = 0; return; } - eprint!("{output}"); - let _ = std::io::stderr().flush(); self.progress_active = true; self.progress_last_len = line.len(); }