diff --git a/vlib/v/fmt/fmt.v b/vlib/v/fmt/fmt.v index db403e30084324..1d9a3263b77d3a 100644 --- a/vlib/v/fmt/fmt.v +++ b/vlib/v/fmt/fmt.v @@ -444,7 +444,7 @@ fn (f &Fmt) should_insert_newline_before_node(node ast.Node, prev_node ast.Node) return false } ast.Block { - if node is ast.Block && !node.is_unsafe && node.pos.line_nr - prev_line_nr > 0 { + if node is ast.Block && !node.is_unsafe && node.pos.line_nr - prev_line_nr > 1 { return true } else { return false diff --git a/vlib/v/parser/parser.v b/vlib/v/parser/parser.v index 841bfd17776221..6fba5b05fdf8ba 100644 --- a/vlib/v/parser/parser.v +++ b/vlib/v/parser/parser.v @@ -1026,7 +1026,7 @@ fn (mut p Parser) stmt(is_top_level bool) ast.Stmt { } } else { stmts := p.parse_block() - pos.last_line = p.prev_tok.line_nr + pos.update_last_line(p.prev_tok.line_nr) return ast.Block{ stmts: stmts pos: pos