Skip to content

Commit

Permalink
WIP: document some items in theme.rs.
Browse files Browse the repository at this point in the history
Quite unsure about several of those.
  • Loading branch information
grunweg committed May 5, 2022
1 parent 7827056 commit 7035699
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/theme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

Expand Down Expand Up @@ -850,13 +853,17 @@ 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)?;
self.height = 0;
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
Expand Down

0 comments on commit 7035699

Please sign in to comment.