diff --git a/CHANGELOG.md b/CHANGELOG.md index 3cde4f35b..bfd9ce82a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -80,6 +80,10 @@ to avoid letting the user edit the immutable one. * Files with conflicts are now checked out as executable if all sides of the conflict are executable. +* The progress bar (visible when using e.g. `jj git clone`) clears the + remainder of the cursor row after drawing rather than clearing the entire row + before drawing, eliminating the "flicker" effect seen on some terminals. + ## [0.17.1] - 2024-05-07 ### Fixed bugs diff --git a/cli/src/progress.rs b/cli/src/progress.rs index 476a6c931..e67b5e88a 100644 --- a/cli/src/progress.rs +++ b/cli/src/progress.rs @@ -60,7 +60,7 @@ impl Progress { self.next_print = now.min(self.next_print + Duration::from_secs(1) / UPDATE_HZ); self.buffer.clear(); - write!(self.buffer, "\r{}", Clear(ClearType::CurrentLine)).unwrap(); + write!(self.buffer, "\r").unwrap(); let control_chars = self.buffer.len(); write!(self.buffer, "{: >3.0}% ", 100.0 * progress.overall).unwrap(); if let Some(total) = progress.bytes_downloaded { @@ -81,6 +81,7 @@ impl Progress { draw_progress(progress.overall, &mut self.buffer, bar_width); self.buffer.push(']'); + write!(self.buffer, "{}", Clear(ClearType::UntilNewLine)).unwrap(); write!(output, "{}", self.buffer)?; output.flush()?; Ok(())