version 1.105, 2010/01/01 14:27:59 |
version 1.106, 2010/01/01 14:32:52 |
Line 471 a2width(const struct mdoc_argv *arg, int pos) |
|
Line 471 a2width(const struct mdoc_argv *arg, int pos) |
|
if ( ! a2roffsu(arg->value[pos], &su, SCALE_MAX)) |
if ( ! a2roffsu(arg->value[pos], &su, SCALE_MAX)) |
SCALE_HS_INIT(&su, strlen(arg->value[pos])); |
SCALE_HS_INIT(&su, strlen(arg->value[pos])); |
|
|
/* XXX: pachemu? */ |
/* |
|
* This is a bit if a magic number on groff's part. Be careful |
|
* in changing it, as the MDOC_Column handler will subtract one |
|
* from this for >5 columns (don't go below zero!). |
|
*/ |
return(term_hspan(&su) + 2); |
return(term_hspan(&su) + 2); |
} |
} |
|
|
Line 651 termp_it_pre(DECL_ARGS) |
|
Line 655 termp_it_pre(DECL_ARGS) |
|
const struct mdoc_node *bl, *nn; |
const struct mdoc_node *bl, *nn; |
char buf[7]; |
char buf[7]; |
int i, type, keys[3], vals[3]; |
int i, type, keys[3], vals[3]; |
size_t width, offset, ncols, dcol; |
size_t width, offset, ncols; |
|
int dcol; |
|
|
if (MDOC_BLOCK == n->type) { |
if (MDOC_BLOCK == n->type) { |
print_bvspace(p, n->parent->parent, n); |
print_bvspace(p, n->parent->parent, n); |
Line 694 termp_it_pre(DECL_ARGS) |
|
Line 699 termp_it_pre(DECL_ARGS) |
|
* For each earlier column, add its width. |
* For each earlier column, add its width. |
* For less than 5 columns, add two more blanks per column. |
* For less than 5 columns, add two more blanks per column. |
* For exactly 5 columns, add only one more blank per column. |
* For exactly 5 columns, add only one more blank per column. |
* For more than 5 columns, add no blanks per column. |
* For more than 5 columns, SUBTRACT one column. We can |
|
* do this because a2width() pads exactly 2 spaces. |
*/ |
*/ |
ncols = bl->args->argv[vals[2]].sz; |
ncols = bl->args->argv[vals[2]].sz; |
/* LINTED */ |
dcol = ncols < 5 ? 2 : ncols == 5 ? 1 : -1; |
dcol = ncols < 5 ? 2 : ncols == 5 ? 1 : 0; |
|
for (i=0, nn=n->prev; nn && i < (int)ncols; nn=nn->prev, i++) |
for (i=0, nn=n->prev; nn && i < (int)ncols; nn=nn->prev, i++) |
offset += a2width(&bl->args->argv[vals[2]], i) + dcol; |
offset += a2width(&bl->args->argv[vals[2]], i) + |
|
(size_t)dcol; |
|
|
/* |
/* |
* FIXME: newer groff only wants one space between |
|
* columns > 5; however, a2width will have min. two |
|
* spaces. For now, let this slide. |
|
*/ |
|
|
|
/* |
|
* Use the declared column widths, |
* Use the declared column widths, |
* extended as explained in the preceding paragraph. |
* extended as explained in the preceding paragraph. |
*/ |
*/ |
if (i < (int)ncols) |
if (i < (int)ncols) |
width = a2width(&bl->args->argv[vals[2]], i) + dcol; |
width = a2width(&bl->args->argv[vals[2]], i) + |
|
(size_t)dcol; |
|
|
/* |
/* |
* When exceeding the declared number of columns, |
* When exceeding the declared number of columns, |