Skip to content

Commit fae17a2

Browse files
committed
Allow configuring show_nonprintable from PrettyPrinter
1 parent 738304f commit fae17a2

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
## `bat` as a library
2121

22+
- Allow crates using `bat` as a library to configure `show_nonprintable` with `PrettyPrinter`, see #2142
2223

2324
# v0.20.0
2425

src/pretty_printer.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,12 @@ impl<'a> PrettyPrinter<'a> {
164164
self
165165
}
166166

167+
/// Whether to print binary content or nonprintable characters (default: no)
168+
pub fn show_nonprintable(&mut self, yes: bool) -> &mut Self {
169+
self.config.show_nonprintable = yes;
170+
self
171+
}
172+
167173
/// Whether to show "snip" markers between visible line ranges (default: no)
168174
pub fn snip(&mut self, yes: bool) -> &mut Self {
169175
self.active_style_components.snip = yes;

0 commit comments

Comments
 (0)