Skip to content

Commit

Permalink
print additional newline if last line in input file was not terminate…
Browse files Browse the repository at this point in the history
…d with a newline (fixes #299)
  • Loading branch information
Rogach authored and sharkdp committed Sep 10, 2018
1 parent 0fe3bad commit e1ecc17
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/printer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit e1ecc17

Please sign in to comment.