From f0aaf3b2964a26a08be13dcf04f31d5bfe46b2f3 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Wed, 27 Nov 2019 05:01:13 +0800 Subject: Fill all last text to space and return the cursor --- crates/ra_cli/src/progress_report.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/ra_cli/src/progress_report.rs b/crates/ra_cli/src/progress_report.rs index 6ce0d4cab..31867a1e9 100644 --- a/crates/ra_cli/src/progress_report.rs +++ b/crates/ra_cli/src/progress_report.rs @@ -107,7 +107,14 @@ impl ProgressReport { } fn clear(&mut self) { - print!("{}{}", " ".repeat(self.text.len()), "\x08".repeat(self.text.len())); + if self.hidden { + return; + } + + // Fill all last text to space and return the cursor + let spaces = " ".repeat(self.text.len()); + let backspaces = "\x08".repeat(self.text.len()); + print!("{}{}{}", backspaces, spaces, backspaces); self.text = String::new(); } } -- cgit v1.2.3