aboutsummaryrefslogtreecommitdiffstats
path: root/src/output.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/output.rs')
-rw-r--r--src/output.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/output.rs b/src/output.rs
index 4b2fb06..7669f4c 100644
--- a/src/output.rs
+++ b/src/output.rs
@@ -127,6 +127,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(&mut self.stdout, &contents).await?;
+ self.cur_mut().process(&contents);
+ Ok(())
+ }
}
async fn write_stdout(