summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2019-12-31 22:49:18 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2019-12-31 22:49:18 +0000
commit231f4faeb2563a707971e6b18db416cee8e72062 (patch)
tree9f03e3b39ae54d9f3d87d2b5a1753d6bbd490674 /usr.bin
parent4c3dd002590186bc6e4dbff8fd43616b432a87ae (diff)
When all cells in a tbl(1) column are empty, set the column width
to 1n rather than to 0n, in the same way as groff does. This fixes misformatting reported by bentley@ in xkeyboard-config(7).
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/mandoc/out.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/usr.bin/mandoc/out.c b/usr.bin/mandoc/out.c
index 8c896e1cd9e..7cc5702b0d4 100644
--- a/usr.bin/mandoc/out.c
+++ b/usr.bin/mandoc/out.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: out.c,v 1.50 2019/03/29 21:25:43 schwarze Exp $ */
+/* $OpenBSD: out.c,v 1.51 2019/12/31 22:49:17 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011,2014,2015,2017,2018 Ingo Schwarze <schwarze@openbsd.org>
@@ -207,13 +207,25 @@ tblcalc(struct rofftbl *tbl, const struct tbl_span *sp_first,
}
/*
- * Column spacings are needed for span width calculations,
- * so set the default values now.
+ * The minimum width of columns explicitly specified
+ * in the layout is 1n.
*/
- for (icol = 0; icol <= maxcol; icol++)
- if (tbl->cols[icol].spacing == SIZE_MAX || icol == maxcol)
- tbl->cols[icol].spacing = 3;
+ if (maxcol < sp_first->opts->cols - 1)
+ maxcol = sp_first->opts->cols - 1;
+ for (icol = 0; icol <= maxcol; icol++) {
+ col = tbl->cols + icol;
+ if (col->width < 1)
+ col->width = 1;
+
+ /*
+ * Column spacings are needed for span width
+ * calculations, so set the default values now.
+ */
+
+ if (col->spacing == SIZE_MAX || icol == maxcol)
+ col->spacing = 3;
+ }
/*
* Replace the minimum widths with the missing widths,