on master help sign in
Allow configuring show_nonprintable from PrettyPrinter
commitb1e67e215c385f926b997e7ef03a674195a52fd0 authoracheronfail <acheronfail@gmail.com> dateFri 1 Apr 2022, 20:24 (5 years ago) parent49317ad
2 files changed+7
CHANGELOG.md+1 src/pretty_printer.rs+6
CHANGELOG.md+1
@@ -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+6
@@ -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;