Fix handling of newlines in empty files (#7473)

This commit is contained in:
Micha Reiser 2023-09-18 08:08:10 +02:00 committed by GitHub
parent b66bfa6570
commit 0346e781d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 90 additions and 15 deletions

View file

@ -124,7 +124,7 @@ impl<'a> Printer<'a> {
self.flush_line_suffixes(queue, stack, Some(element));
} else {
// Only print a newline if the current line isn't already empty
if self.state.line_width > 0 || self.state.buffer.is_empty() {
if self.state.line_width > 0 {
self.print_char('\n');
}