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 sharkdp#299)
  • Loading branch information
Rogach committed Sep 10, 2018
1 parent 0fe3bad commit 12ffdfd
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 12ffdfd

Please sign in to comment.