print additional newline if last line in input file was not terminated with a newline (fixes #299)

This commit is contained in:
Rogach 2018-09-10 22:36:58 +03:00 committed by David Peter
parent 0fe3badf19
commit e1ecc17f69
1 changed files with 4 additions and 0 deletions

View File

@ -243,6 +243,10 @@ impl<'a> Printer for InteractivePrinter<'a> {
)).collect::<Vec<_>>()
.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);