diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2017-06-27 18:25:02 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2017-06-27 18:25:02 +0000 |
commit | 4810b815f8d91b4ce1c346e211abc6f5abbad778 (patch) | |
tree | a85a3bc0b26547badb2fcc130ca8bbf76afb6d25 /out.c | |
parent | e9817d1eee252f2a60704c140932abd01803441b (diff) | |
download | mandoc-4810b815f8d91b4ce1c346e211abc6f5abbad778.tar.gz |
Implement spacing of columns as defined in the table layout;
this is for example used by lftp(1)
and, ironically, misused by our very own tbl(7) manual...
Diffstat (limited to 'out.c')
-rw-r--r-- | out.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -20,6 +20,7 @@ #include <sys/types.h> #include <assert.h> +#include <stdint.h> #include <stdlib.h> #include <string.h> #include <time.h> @@ -140,8 +141,8 @@ tblcalc(struct rofftbl *tbl, const struct tbl_span *sp, if (1 < spans) continue; icol = dp->layout->col; - if (maxcol < icol) - maxcol = icol; + while (maxcol < icol) + tbl->cols[++maxcol].spacing = SIZE_MAX; col = tbl->cols + icol; col->flags |= dp->layout->flags; if (dp->layout->flags & TBL_CELL_WIGN) @@ -154,6 +155,10 @@ tblcalc(struct rofftbl *tbl, const struct tbl_span *sp, (*tbl->sulen)(&su, tbl->arg); if (col->width < dp->layout->width) col->width = dp->layout->width; + if (dp->layout->spacing != SIZE_MAX && + (col->spacing == SIZE_MAX || + col->spacing < dp->layout->spacing)) + col->spacing = dp->layout->spacing; tblcalc_data(tbl, col, opts, dp, dp->block == 0 ? 0 : dp->layout->width ? dp->layout->width : @@ -172,6 +177,8 @@ tblcalc(struct rofftbl *tbl, const struct tbl_span *sp, ewidth = xwidth = 0; for (icol = 0; icol <= maxcol; icol++) { col = tbl->cols + icol; + if (col->spacing == SIZE_MAX || icol == maxcol) + col->spacing = 3; if (col->flags & TBL_CELL_EQUAL) { necol++; if (ewidth < col->width) |