Skip to content

Commit 2df7598

Browse files
committed
Add writeln to print without breaking pbr
1 parent d077b49 commit 2df7598

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/pb.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,13 @@ impl<T: Write> ProgressBar<T> {
396396
self.last_refresh_time = SteadyTime::now();
397397
}
398398

399+
/// Print a line above the progress bar
400+
pub fn writeln(&mut self, s: &str) {
401+
printfl!(self.handle, "\r\x1B[2K{}\n", s);
402+
self.draw();
403+
}
404+
405+
399406
// finish_draw ensure that the progress bar is reached to its end, and do the
400407
// last drawing if needed.
401408
fn finish_draw(&mut self) {

0 commit comments

Comments
 (0)