Skip to content

Commit

Permalink
doc: document four functions in theme.rs.
Browse files Browse the repository at this point in the history
  • Loading branch information
grunweg committed May 5, 2022
1 parent f101308 commit f77ba29
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/theme.rs
Expand Up @@ -655,10 +655,14 @@ impl<'a> TermThemeRenderer<'a> {
self.term
}

/// Enlarge the theme by one line: allow displaying one more line of input.
pub fn add_line(&mut self) {
self.height += 1;
}

/// Write a formatted string to this terminal. The string can be span multiple lines.
///
/// `F` is a closure prescribing the text to write into the current instance.
fn write_formatted_str<
F: FnOnce(&mut TermThemeRenderer, &mut dyn fmt::Write) -> fmt::Result,
>(
Expand All @@ -671,6 +675,7 @@ impl<'a> TermThemeRenderer<'a> {
self.term.write_str(&buf)
}

/// Like [`write_formatted_string`](#method::write_formatted_string), but add a linebreak afterwards.
fn write_formatted_line<
F: FnOnce(&mut TermThemeRenderer, &mut dyn fmt::Write) -> fmt::Result,
>(
Expand All @@ -683,6 +688,9 @@ impl<'a> TermThemeRenderer<'a> {
self.term.write_line(&buf)
}

/// Write a formatted prompt string to this terminal.
///
/// `F` is a closure prescribing the text to write into the current instance.
fn write_formatted_prompt<
F: FnOnce(&mut TermThemeRenderer, &mut dyn fmt::Write) -> fmt::Result,
>(
Expand Down

0 comments on commit f77ba29

Please sign in to comment.