diff --git a/src/theme.rs b/src/theme.rs index c4776971..597c4e13 100644 --- a/src/theme.rs +++ b/src/theme.rs @@ -626,8 +626,11 @@ impl Theme for ColorfulTheme { pub(crate) struct TermThemeRenderer<'a> { term: &'a Term, theme: &'a dyn Theme, + /// Number of lines of input in the current theme. height: usize, + /// Height of the current prompt string in the current theme. prompt_height: usize, + /// TODO what's this? prompts_reset_height: bool, } @@ -850,6 +853,9 @@ impl<'a> TermThemeRenderer<'a> { }) } + /// Clear the current theme. + /// + /// Position the cursor at the beginning of the current line. pub fn clear(&mut self) -> io::Result<()> { self.term .clear_last_lines(self.height + self.prompt_height)?; @@ -857,6 +863,7 @@ impl<'a> TermThemeRenderer<'a> { Ok(()) } + /// Clear the current theme no idea about prompt! pub fn clear_preserve_prompt(&mut self, size_vec: &[usize]) -> io::Result<()> { let mut new_height = self.height; // Check each item size, increment on finding an overflow