diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2011-01-08 17:00:27 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2011-01-08 17:00:27 +0000 |
commit | 74fefd1ac6f4b27426d1a6a6dc64e5c52b84945d (patch) | |
tree | a2a44747a873bf2886c06f93a0e172dcf198eb75 /out.c | |
parent | d6b4b7d01dc50c7808c233cb162e71c30a817c08 (diff) | |
download | mandoc-74fefd1ac6f4b27426d1a6a6dc64e5c52b84945d.tar.gz mandoc-74fefd1ac6f4b27426d1a6a6dc64e5c52b84945d.tar.zst mandoc-74fefd1ac6f4b27426d1a6a6dc64e5c52b84945d.zip |
Give the "n" cell type knowledge of its spacing.
Diffstat (limited to 'out.c')
-rw-r--r-- | out.c | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -1,4 +1,4 @@ -/* $Id: out.c,v 1.30 2011/01/05 15:37:23 kristaps Exp $ */ +/* $Id: out.c,v 1.31 2011/01/08 17:00:27 kristaps Exp $ */ /* * Copyright (c) 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -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; } |