aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurenČ›iu Nicola <[email protected]>2020-12-24 13:38:40 +0000
committerLaurenČ›iu Nicola <[email protected]>2020-12-24 13:38:45 +0000
commitb21a79364a6fdcfc6746a6f938c5b2a2e30128b0 (patch)
tree6676720f1f95124eeb023cd1fd53feea7a3d92ff
parent3d5d21b60253e94bf1a96a4fdb2d23d7c52d1480 (diff)
Flush stdout when clearing the progress bar
-rw-r--r--crates/rust-analyzer/src/cli/progress_report.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/crates/rust-analyzer/src/cli/progress_report.rs b/crates/rust-analyzer/src/cli/progress_report.rs
index bdbe565e6..5a2dc39d5 100644
--- a/crates/rust-analyzer/src/cli/progress_report.rs
+++ b/crates/rust-analyzer/src/cli/progress_report.rs
@@ -1,7 +1,7 @@
1//! A simple progress bar 1//! A simple progress bar
2//! 2//!
3//! A single thread non-optimized progress bar 3//! A single thread non-optimized progress bar
4use std::io::Write; 4use std::io::{self, Write};
5 5
6/// A Simple ASCII Progress Bar 6/// A Simple ASCII Progress Bar
7pub(crate) struct ProgressReport { 7pub(crate) struct ProgressReport {
@@ -97,8 +97,8 @@ impl ProgressReport {
97 } 97 }
98 } 98 }
99 99
100 let _ = std::io::stdout().write(output.as_bytes()); 100 let _ = io::stdout().write(output.as_bytes());
101 let _ = std::io::stdout().flush(); 101 let _ = io::stdout().flush();
102 self.text = text.to_string(); 102 self.text = text.to_string();
103 } 103 }
104 104
@@ -115,6 +115,8 @@ impl ProgressReport {
115 let spaces = " ".repeat(self.text.len()); 115 let spaces = " ".repeat(self.text.len());
116 let backspaces = "\x08".repeat(self.text.len()); 116 let backspaces = "\x08".repeat(self.text.len());
117 print!("{}{}{}", backspaces, spaces, backspaces); 117 print!("{}{}{}", backspaces, spaces, backspaces);
118 let _ = io::stdout().flush();
119
118 self.text = String::new(); 120 self.text = String::new();
119 } 121 }
120} 122}