aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-12-24 13:40:29 +0000
committerGitHub <[email protected]>2020-12-24 13:40:29 +0000
commita31ee54afa5edfc3c470e3b1cdb5a553c0176d33 (patch)
tree5355e5f3ebf422cb74501594ba1b73e492053b7c
parentaebf7ee2b65fdb51e125fc1461554cd9f673c60e (diff)
parentb21a79364a6fdcfc6746a6f938c5b2a2e30128b0 (diff)
Merge #7029
7029: Flush stdout when clearing the progress bar r=lnicola a=lnicola To prevent this from happening: ``` Database loaded 496.24ms, 288mi Crates in this dir: 1 Total modules found: 14 Total declarations: 159 Total functions: 122 Item Collection: 6.02s, 61846mi 122/122 100% processing: archive::sizeTotal expressions: 6592 Expressions of unknown type: 4 (0%) Expressions of partially unknown type: 104 (1%) Type mismatches: 3 Inference: 1.03s, 8622mi Total: 7.05s, 70468mi ``` Co-authored-by: LaurenČ›iu Nicola <[email protected]>
-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}