diff options
author | sharkdp <davidpeter@web.de> | 2018-05-08 23:49:59 +0200 |
---|---|---|
committer | sharkdp <davidpeter@web.de> | 2018-05-08 23:49:59 +0200 |
commit | 8b9991d7808d65782844ac68a2f9c53fa4225dc6 (patch) | |
tree | cd1ebc29c35ee3019d6d680a9eae4f2499e4124c | |
parent | f59ddd1e3607664800b58657404215e8e8cb7592 (diff) |
Append newline at the end of the file if necessaryv0.3.0
-rw-r--r-- | src/main.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs index 78c794cb..773f3432 100644 --- a/src/main.rs +++ b/src/main.rs @@ -199,7 +199,12 @@ fn print_file( Ok(0) => { break; } - Ok(_) => &line_buffer, + Ok(_) => { + if !line_buffer.ends_with("\n") { + line_buffer.push('\n'); + } + &line_buffer + } Err(_) => "<bat: INVALID UTF-8>\n", }; |