diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2019-12-31 22:58:41 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2019-12-31 22:58:41 +0000 |
commit | a951e29478bd5be4d2e27779d5dc6cb19032bd9e (patch) | |
tree | 5870d878dbeea0c5c7225976a64a327e82e06c60 /out.c | |
parent | e3b08adce89f0d56af5c8c001beda568cf5e3456 (diff) | |
download | mandoc-a951e29478bd5be4d2e27779d5dc6cb19032bd9e.tar.gz |
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 | 22 |
1 files changed, 17 insertions, 5 deletions
@@ -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, |