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 Oct 23, 2021
1 parent dde770a commit 50b5712
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 @@ -218,6 +218,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 50b5712

Please sign in to comment.