Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

## `bat` as a library

- Allow configuration of `show_nonprintable` with `PrettyPrinter`, see #2142

# v0.20.0

Expand Down
6 changes: 6 additions & 0 deletions src/pretty_printer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,12 @@ impl<'a> PrettyPrinter<'a> {
self
}

/// Whether to print binary content or nonprintable characters (default: no)
pub fn show_nonprintable(&mut self, yes: bool) -> &mut Self {
self.config.show_nonprintable = yes;
self
}

/// Whether to show "snip" markers between visible line ranges (default: no)
pub fn snip(&mut self, yes: bool) -> &mut Self {
self.active_style_components.snip = yes;
Expand Down