diff options
author | 2019-12-31 22:58:41 +0000 | |
---|---|---|
committer | 2019-12-31 22:58:41 +0000 | |
commit | 5a317ea1cdb4526d1f081d9c2176e90001bdc79c (patch) | |
tree | 373e7210f5a3f0d7c3da04418f675900837a058d /out.c | |
parent | b790074f54bc970c3e4ef82aad5e8ce6f7fba5b3 (diff) | |
download | mandoc-5a317ea1cdb4526d1f081d9c2176e90001bdc79c.tar.gz mandoc-5a317ea1cdb4526d1f081d9c2176e90001bdc79c.tar.zst mandoc-5a317ea1cdb4526d1f081d9c2176e90001bdc79c.zip |
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 'out.c')
-rw-r--r-- | out.c | 24 |
1 files changed, 18 insertions, 6 deletions
@@ -1,4 +1,4 @@ -/* $Id: out.c,v 1.78 2019/03/29 21:27:06 schwarze Exp $ */ +/* $Id: out.c,v 1.79 2019/12/31 22:58:41 schwarze Exp $ */ /* * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2011,2014,2015,2017,2018 Ingo Schwarze <schwarze@openbsd.org> @@ -209,13 +209,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, |