aboutsummaryrefslogtreecommitdiff
path: root/src/formatter/formatter.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/formatter/formatter.c')
-rw-r--r--src/formatter/formatter.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/formatter/formatter.c b/src/formatter/formatter.c
index 1719a294..824a936a 100644
--- a/src/formatter/formatter.c
+++ b/src/formatter/formatter.c
@@ -433,8 +433,10 @@ Text_t format_code(ast_t *ast, Table_t comments, Text_t indent) {
comment_pos = stmt->ast->end;
if (stmt->next) {
- for (int blanks = suggested_blank_lines(stmt->ast, stmt->next->ast); blanks > 0; blanks--)
+ int suggested_blanks = suggested_blank_lines(stmt->ast, stmt->next->ast);
+ for (int blanks = suggested_blanks; blanks > 0; blanks--)
add_line(&code, Text(""), indent);
+ gap_before_comment = (suggested_blanks == 0);
} else gap_before_comment = true;
}