zig fmt: Fix rendering of arrays with single row

rowSize used to return null if all the elements were placed on the same
line as the right brace, making the rendering logic skip the whole set
of elements.

Given the usage of rowSize let's just drop the null and always return
the number of elements.

Fixes #8423
This commit is contained in:
LemonBoy
2021-04-09 10:29:39 +02:00
committed by Andrew Kelley
parent cc525bc002
commit 5ebcd8ccaf
2 changed files with 11 additions and 6 deletions

View File

@@ -1812,6 +1812,8 @@ test "zig fmt: array literal veritical column alignment" {
\\ 4,5,600,7,
\\ 80,
\\ 9, 10, 11, 0, 13, 14, 15};
\\const a = [12]u8{
\\ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
\\
,
\\const a = []u8{
@@ -1825,6 +1827,9 @@ test "zig fmt: array literal veritical column alignment" {
\\ 9, 10, 11, 0, 13,
\\ 14, 15,
\\};
\\const a = [12]u8{
\\ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,
\\};
\\
);
}