summaryrefslogtreecommitdiffstats
path: root/out.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-01-08 17:00:27 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-01-08 17:00:27 +0000
commit29f8344876163462796a63fb0835930cea1b51ce (patch)
tree37104860271039bde1ad7adc3c4b9ab5d1af38c0 /out.c
parente524e4faa861bbbcd2c8889fd1731bf9cf334399 (diff)
downloadmandoc-29f8344876163462796a63fb0835930cea1b51ce.tar.gz
Give the "n" cell type knowledge of its spacing.
Diffstat (limited to 'out.c')
-rw-r--r--out.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/out.c b/out.c
index 9e89321f..8cc80e64 100644
--- a/out.c
+++ b/out.c
@@ -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;
}