diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-08-30 14:29:50 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-08-30 14:29:50 -0400 |
| commit | f2ad722780f96dc5fb7d93f536c7267741be3f6f (patch) | |
| tree | 1cea1fd4c16bddd5a8a92794d0ebd3ee42b6cf1d /src/formatter/formatter.c | |
| parent | 9f17271a07f10f05e63e0064d8ab4a92267f5f66 (diff) | |
Fix line gaps
Diffstat (limited to 'src/formatter/formatter.c')
| -rw-r--r-- | src/formatter/formatter.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/formatter/formatter.c b/src/formatter/formatter.c index 8b8aeb1b..98f0f59b 100644 --- a/src/formatter/formatter.c +++ b/src/formatter/formatter.c @@ -414,9 +414,6 @@ Text_t format_code(ast_t *ast, Table_t comments, Text_t indent) { bool gap_before_comment = false; const char *comment_pos = ast->start; for (ast_list_t *stmt = Match(ast, Block)->statements; stmt; stmt = stmt->next) { - for (int blanks = suggested_blank_lines(stmt->ast); blanks > 0; blanks--) - add_line(&code, Text(""), indent); - for (OptionalText_t comment; (comment = next_comment(comments, &comment_pos, stmt->ast->start)).length > 0;) { if (gap_before_comment) { @@ -430,8 +427,7 @@ 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) - suggested_blank_lines(stmt->next->ast); blanks > 0; - blanks--) + for (int blanks = suggested_blank_lines(stmt->ast, stmt->next->ast); blanks > 0; blanks--) add_line(&code, Text(""), indent); } else gap_before_comment = true; } |
