diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2009-07-23 08:36:32 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2009-07-23 08:36:32 +0000 |
commit | 426e06d7acebfcaf0c471eb4e2c86d0df54c4035 (patch) | |
tree | ae1a3577aa22b77e3a2c1c676f55ccb576102418 /mdoc_term.c | |
parent | dfce0426aaf96843f0845cc6bfae0c0fef4ce7d0 (diff) | |
download | mandoc-426e06d7acebfcaf0c471eb4e2c86d0df54c4035.tar.gz |
Bl -column now accepts columns = (1 + stated columns), which covers all remaining column usage/abuse I can see.
Diffstat (limited to 'mdoc_term.c')
-rw-r--r-- | mdoc_term.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/mdoc_term.c b/mdoc_term.c index 9e85d37f..d6d043c0 100644 --- a/mdoc_term.c +++ b/mdoc_term.c @@ -782,11 +782,27 @@ termp_it_pre(DECL_ARGS) case (MDOC_Column): if (MDOC_BODY == node->type) break; - for (i = 0, n = node->prev; n; n = n->prev, i++) + /* + * Work around groff's column handling. The offset is + * equal to the sum of all widths leading to the current + * column (plus the -offset value). If this column + * exceeds the stated number of columns, the width is + * set as 0, else it's the stated column width (later + * the 0 will be adjusted to default 10 or, if in the + * last column case, set to stretch to the margin). + */ + for (i = 0, n = node->prev; n && n && + i < (int)bl->args[vals[2]].argv->sz; + n = n->prev, i++) offset += arg_width (&bl->args->argv[vals[2]], i); - assert(i < (int)bl->args->argv[vals[2]].sz); - width = arg_width(&bl->args->argv[vals[2]], i); + + /* Whether exceeds maximum column. */ + if (i < (int)bl->args[vals[2]].argv->sz) + width = arg_width(&bl->args->argv[vals[2]], i); + else + width = 0; + if (vals[1] >= 0) offset += arg_offset(&bl->args->argv[vals[1]]); break; |