aboutsummaryrefslogtreecommitdiffstats
path: root/src/blocking/output.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/blocking/output.rs')
-rw-r--r--src/blocking/output.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/blocking/output.rs b/src/blocking/output.rs
index 77e13d2..cf24e3d 100644
--- a/src/blocking/output.rs
+++ b/src/blocking/output.rs
@@ -114,6 +114,18 @@ impl Output {
self.cur_mut().process(&diff);
Ok(())
}
+
+ /// Draws the in-memory screen to the terminal on `stdout`. This clears
+ /// the screen and redraws it from scratch, rather than using a diff
+ /// mechanism like `refresh`. This can be useful when the current state of
+ /// the terminal screen is unknown, such as after the terminal has been
+ /// resized.
+ pub async fn hard_refresh(&mut self) -> Result<()> {
+ let contents = self.next().screen().state_formatted();
+ write_stdout(&contents)?;
+ self.cur_mut().process(&contents);
+ Ok(())
+ }
}
fn write_stdout(buf: &[u8]) -> Result<()> {