mirror of
https://github.com/sharkdp/bat.git
synced 2024-12-23 06:48:53 +01:00
Append newline at the end of the file if necessary
This commit is contained in:
parent
f59ddd1e36
commit
8b9991d780
@ -199,7 +199,12 @@ fn print_file(
|
|||||||
Ok(0) => {
|
Ok(0) => {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Ok(_) => &line_buffer,
|
Ok(_) => {
|
||||||
|
if !line_buffer.ends_with("\n") {
|
||||||
|
line_buffer.push('\n');
|
||||||
|
}
|
||||||
|
&line_buffer
|
||||||
|
}
|
||||||
Err(_) => "<bat: INVALID UTF-8>\n",
|
Err(_) => "<bat: INVALID UTF-8>\n",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user