From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailout.scc.kit.edu (mailout.scc.kit.edu [129.13.185.202]) by krisdoz.my.domain (8.14.5/8.14.5) with ESMTP id q4QL31xG002780 for ; Sat, 26 May 2012 17:03:01 -0400 (EDT) Received: from hekate.usta.de (asta-nat.asta.uni-karlsruhe.de [172.22.63.82]) by scc-mailout-02.scc.kit.edu with esmtp (Exim 4.72 #1) id 1SYO8a-00037X-J1; Sat, 26 May 2012 23:03:00 +0200 Received: from donnerwolke.usta.de ([172.24.96.3]) by hekate.usta.de with esmtp (Exim 4.77) (envelope-from ) id 1SYO8a-0007kE-Io for tech@mdocml.bsd.lv; Sat, 26 May 2012 23:03:00 +0200 Received: from iris.usta.de ([172.24.96.5] helo=usta.de) by donnerwolke.usta.de with esmtp (Exim 4.72) (envelope-from ) id 1SYO8a-0006oo-Hi for tech@mdocml.bsd.lv; Sat, 26 May 2012 23:03:00 +0200 Received: from schwarze by usta.de with local (Exim 4.77) (envelope-from ) id 1SYO8a-0007ZD-Gx for tech@mdocml.bsd.lv; Sat, 26 May 2012 23:03:00 +0200 Date: Sat, 26 May 2012 23:03:00 +0200 From: Ingo Schwarze To: tech@mdocml.bsd.lv Subject: correct width of horizontal spans Message-ID: <20120526210300.GC31629@iris.usta.de> X-Mailinglist: mdocml-tech Reply-To: tech@mdocml.bsd.lv MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Now that the 150 lines i just deleted are out of the way, this is quite easy. You want this, too? ----- Forwarded message from Ingo Schwarze ----- From: Ingo Schwarze Date: Sat, 26 May 2012 14:53:17 -0600 (MDT) To: source-changes@cvs.openbsd.org CVSROOT: /cvs Module name: src Changes by: schwarze@cvs.openbsd.org 2012/05/26 14:53:17 Modified files: usr.bin/mandoc : tbl_term.c Log message: 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. ----- End forwarded message ----- Index: tbl_term.c =================================================================== RCS file: /cvs/src/usr.bin/mandoc/tbl_term.c,v retrieving revision 1.11 diff -u -p -r1.11 tbl_term.c --- tbl_term.c 26 May 2012 20:03:34 -0000 1.11 +++ tbl_term.c 26 May 2012 20:47:48 -0000 @@ -1,7 +1,7 @@ /* $Id: tbl_term.c,v 1.11 2012/05/26 20:03:34 schwarze Exp $ */ /* * Copyright (c) 2009, 2011 Kristaps Dzonsons - * Copyright (c) 2011 Ingo Schwarze + * Copyright (c) 2011, 2012 Ingo Schwarze * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -333,11 +333,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) { -- To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv