Skip to content

Commit

Permalink
Add bat::PrettyPrinter::clear_highlights (fixes sharkdp#1919)
Browse files Browse the repository at this point in the history
  • Loading branch information
rhysd committed Sep 5, 2022
1 parent 113276a commit abd69f2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/pretty_printer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,14 @@ impl<'a> PrettyPrinter<'a> {
self
}

/// Clear highlighted lines added by [`PrettyPrinter::highlight`] and
/// [`PrettyPrinter::highlight_range`]. This is useful when reusing a
/// `PrettyPrinter` instance for multiple different ranges.
pub fn clear_highlights(&mut self) -> &mut Self {
self.highlighted_lines.clear();
self
}

/// Specify the highlighting theme
pub fn theme(&mut self, theme: impl AsRef<str>) -> &mut Self {
self.config.theme = theme.as_ref().to_owned();
Expand Down

0 comments on commit abd69f2

Please sign in to comment.