diff options
-rw-r--r-- | out.c | 14 | ||||
-rw-r--r-- | tbl.7 | 16 | ||||
-rw-r--r-- | tbl_term.c | 3 |
3 files changed, 16 insertions, 17 deletions
@@ -503,13 +503,11 @@ tblcalc_number(struct rofftbl *tbl, struct roffcol *col, const struct tbl *tp, const struct tbl_dat *dp) { int i; - size_t sz, psz, ssz, d; + size_t sz, psz, ssz, d, max; char *cp; const char *str; char buf[2]; - /* TODO: use spacing modifier. */ - /* * First calculate number width and decimal place (last + 1 for * no-decimal numbers). If the stored decimal is subsequent @@ -519,9 +517,8 @@ tblcalc_number(struct rofftbl *tbl, struct roffcol *col, * Finally, re-assign the stored values. */ - str = ""; - if (dp->string) - str = dp->string; + str = dp && dp->string ? dp->string : ""; + max = dp && dp->layout ? dp->layout->spacing : 0; sz = (*tbl->slen)(str, tbl->arg); @@ -557,6 +554,11 @@ tblcalc_number(struct rofftbl *tbl, struct roffcol *col, col->width = sz; if (d > col->decimal) col->decimal = d; + + /* Adjust for stipulated width. */ + + if (col->width < max) + col->width = max; } @@ -231,16 +231,9 @@ Emit a vertical bar instead of data. Emit a double-vertical bar instead of data. .El .Pp -For example, the following layout specifies a centre-justified column of -minimum width 10, followed by vertical bar, followed by a left-justified -column of minimum width 10, another vertical bar, then a column -justified about the decimal point in numbers: -.Pp -.Dl c10 | l10 | n -.Pp Keys may be followed by a set of modifiers. A modifier is either a modifier key or a natural number for specifying -spacing. +the minimum width of a column. The following case-insensitive modifier keys are available: .Cm z , .Cm u , @@ -255,6 +248,13 @@ and .Cm i . All of these are ignored by .Xr mandoc 1 . +.Pp +For example, the following layout specifies a centre-justified column of +minimum width 10, followed by vertical bar, followed by a left-justified +column of minimum width 10, another vertical bar, then a column +justified about the decimal point in numbers: +.Pp +.Dl c10 | l10 | n .Ss Data The data section follows the last layout row. By default, cells in a data section are delimited by a tab. @@ -27,9 +27,6 @@ #include "out.h" #include "term.h" -/* FIXME: `n' modifier doesn't always do the right thing. */ -/* FIXME: `n' modifier doesn't use the cell-spacing buffer. */ - static size_t term_tbl_len(size_t, void *); static size_t term_tbl_strlen(const char *, void *); static void tbl_char(struct termp *, char, size_t); |