aboutsummaryrefslogtreecommitdiff
path: root/src/formatter/formatter.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-08-30 16:02:17 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-08-30 16:02:17 -0400
commitb025a65b45e8f2e8a56eb087743f9e9e7109b9f8 (patch)
tree6596089d113f0752342043b6c1f04918eaf52a52 /src/formatter/formatter.c
parent9090a2a09f119510f40c5385f3790cc6b6539abc (diff)
Tweak empty gaps
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;
}