@@ -52,15 +52,17 @@ pub(crate) trait Printer {
52 ) -> Result<()>;
52 ) -> Result<()>;
55−pub struct SimplePrinter;
55+pub struct SimplePrinter<'a> {
56+ config: &'a Config<'a>
57−impl SimplePrinter {
59+impl<'a> SimplePrinter<'a> {
58− pub fn new() -> Self {
60+ pub fn new(config: &'a Config) -> Self {
59− SimplePrinter {}
61+ SimplePrinter { config }
63−impl Printer for SimplePrinter {
65+impl<'a> Printer for SimplePrinter<'a> {
64 fn print_header(
66 fn print_header(
65 &mut self,
67 &mut self,
66 _handle: &mut dyn Write,
68 _handle: &mut dyn Write,
@@ -86,7 +88,15 @@ impl Printer for SimplePrinter {
86 line_buffer: &[u8],
88 line_buffer: &[u8],
87 ) -> Result<()> {
89 ) -> Result<()> {
88 if !out_of_range {
90 if !out_of_range {
91+ if self.config.show_nonprintable {
92+ let line = replace_nonprintable(line_buffer, self.config.tab_width);
93+ write!(handle, "{}", line)?;
94+ if line_buffer.last() == Some(&b'\n') {
89− handle.write_all(line_buffer)?;
98+ handle.write_all(line_buffer)?