Skip to content

Commit 8266e8a

Browse files
committed
OK, now pgindent has blank lines before comment blocks, except when
there is a brace on the line above it.
1 parent 2d7795e commit 8266e8a

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

src/tools/pgindent/pgindent

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ then echo "You appear to have GNU indent rather than BSD indent." >&2
1919
echo "See the pgindent/README file for a description of its problems." >&2
2020
EXTRA_OPTS="-ncdb -bli0 -npcs -cli4"
2121
else echo "Hope you installed /src/tools/pgindent/indent.bsd.patch." >&2
22-
EXTRA_OPTS="-cli1"
22+
EXTRA_OPTS="-bbb -cli1"
2323
fi
2424

2525
for FILE
@@ -1343,6 +1343,36 @@ do
13431343
if (skips <= 2)
13441344
print line2;
13451345
}' |
1346+
# remove blank line between opening brace and block comment
1347+
awk '
1348+
{
1349+
line3 = $0;
1350+
if (skips > 0)
1351+
skips--;
1352+
if (line1 ~ " *{$" &&
1353+
line2 ~ "^$" &&
1354+
line3 ~ " */\\*$")
1355+
{
1356+
print line1;
1357+
print line3;
1358+
line1 = "";
1359+
line2 = "";
1360+
line3 = "";
1361+
skips = 3;
1362+
}
1363+
else
1364+
if (skips == 0 && NR >= 3)
1365+
print line1;
1366+
line1 = line2;
1367+
line2 = line3;
1368+
line3 = "";
1369+
}
1370+
END {
1371+
if (skips <= 1)
1372+
print line1;
1373+
if (skips <= 2)
1374+
print line2;
1375+
}' |
13461376
# Move prototype names to the same line as return type. Useful for ctags.
13471377
# Indent should do this, but it does not. It formats prototypes just
13481378
# like real functions.

0 commit comments

Comments
 (0)