From 12ffdfd497c7b21520024ff9871d45c7c5560f7f Mon Sep 17 00:00:00 2001 From: Rogach Date: Mon, 10 Sep 2018 22:36:58 +0300 Subject: [PATCH] print additional newline if last line in input file was not terminated with a newline (fixes #299) --- src/printer.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/printer.rs b/src/printer.rs index afa2ac8b9e..10a44fba79 100644 --- a/src/printer.rs +++ b/src/printer.rs @@ -243,6 +243,10 @@ impl<'a> Printer for InteractivePrinter<'a> { )).collect::>() .join("") )?; + + if line.bytes().next_back() != Some(b'\n') { + write!(handle, "\n")?; + } } else { for &(style, region) in regions.iter() { let mut ansi_iterator = AnsiCodeIterator::new(region);