mirror of
https://github.com/roc-lang/roc.git
synced 2025-07-24 15:03:46 +00:00
Fix edge case in ensure_ends_in_newline
This commit is contained in:
parent
3195e0cff3
commit
bd194af67c
1 changed files with 4 additions and 1 deletions
|
@ -99,7 +99,10 @@ impl<'a> Buf<'a> {
|
|||
/// Ensures the current buffer ends in a newline, if it didn't already.
|
||||
/// Doesn't add a newline if the buffer already ends in one.
|
||||
pub fn ensure_ends_in_newline(&mut self) {
|
||||
if !self.text.ends_with('\n') {
|
||||
if self.spaces_to_flush > 0 {
|
||||
self.flush_spaces();
|
||||
self.newline();
|
||||
} else if !self.text.ends_with('\n') {
|
||||
self.newline()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue