summaryrefslogtreecommitdiffstats
path: root/tbl_term.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2012-05-27 17:59:23 +0000
committerIngo Schwarze <schwarze@openbsd.org>2012-05-27 17:59:23 +0000
commitfb13aa623b3cf28e077ca2d095f527be1fd24fb0 (patch)
tree538eaf9f695ace4d10ab57bb406832ee9b4a3840 /tbl_term.c
parentaa6d8ba46cf4b68619e16a7ea8a8cc36f3f3bfc5 (diff)
downloadmandoc-fb13aa623b3cf28e077ca2d095f527be1fd24fb0.tar.gz
Correct width of horizontal spans; relevant in case of centered or
flush right text, for boxes, and when more columns follow the span. Issue found by sthen@ in the net/arp-scan(1) port manual. "Please check them in and I'll look into them later!" kristaps@
Diffstat (limited to 'tbl_term.c')
-rw-r--r--tbl_term.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/tbl_term.c b/tbl_term.c
index 72267dc5..94f6ecc3 100644
--- a/tbl_term.c
+++ b/tbl_term.c
@@ -1,7 +1,7 @@
/* $Id$ */
/*
* Copyright (c) 2009, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2011, 2012 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -337,11 +337,19 @@ static void
tbl_literal(struct termp *tp, const struct tbl_dat *dp,
const struct roffcol *col)
{
- size_t len, padl, padr;
+ struct tbl_head *hp;
+ size_t width, len, padl, padr;
+ int spans;
assert(dp->string);
len = term_strlen(tp, dp->string);
- padr = col->width > len ? col->width - len : 0;
+
+ hp = dp->layout->head->next;
+ width = col->width;
+ for (spans = dp->spans; spans--; hp = hp->next)
+ width += tp->tbl.cols[hp->ident].width + 3;
+
+ padr = width > len ? width - len : 0;
padl = 0;
switch (dp->layout->pos) {