From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from scc-mailout-kit-01-web.scc.kit.edu (scc-mailout-kit-01-web.scc.kit.edu [129.13.231.93]); by fantadrom.bsd.lv (OpenSMTPD) with ESMTP id 57190be6; for ; Fri, 6 Mar 2015 08:44:02 -0500 (EST) Received: from asta-nat.asta.uni-karlsruhe.de ([172.22.63.82] helo=hekate.usta.de) by scc-mailout-kit-01.scc.kit.edu with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (envelope-from ) id 1YTsXo-0004Hz-3i for tech@mdocml.bsd.lv; Fri, 06 Mar 2015 14:44:01 +0100 Received: from donnerwolke.usta.de ([172.24.96.3]) by hekate.usta.de with esmtp (Exim 4.77) (envelope-from ) id 1YTsXn-0005mz-U2 for tech@mdocml.bsd.lv; Fri, 06 Mar 2015 14:43:59 +0100 Received: from athene.usta.de ([172.24.96.10]) by donnerwolke.usta.de with esmtp (Exim 4.80) (envelope-from ) id 1YTsXn-0000mo-M4 for tech@mdocml.bsd.lv; Fri, 06 Mar 2015 14:43:59 +0100 Received: from localhost (1031@localhost [local]); by localhost (OpenSMTPD) with ESMTPA id f0d87c99; for ; Fri, 6 Mar 2015 14:43:59 +0100 (CET) Date: Fri, 6 Mar 2015 14:43:59 +0100 From: Ingo Schwarze To: tech@mdocml.bsd.lv Subject: Re: tbl(7) and preceding line boundaries Message-ID: <20150306134359.GB12226@athene.usta.de> References: <54F976CF.6020604@bsd.lv> <20150306104909.GA12226@athene.usta.de> <54F989C4.20304@bsd.lv> X-Mailinglist: mdocml-tech Reply-To: tech@mdocml.bsd.lv MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <54F989C4.20304@bsd.lv> User-Agent: Mutt/1.5.23 (2014-03-12) Hi Kristaps, Kristaps Dzonsons wrote on Fri, Mar 06, 2015 at 12:04:36PM +0100: > Actually, a new problem has arisen. If I now put a `Pp' in front of > the `TS', it effects a double newline in mandoc(1) output instead of > the expected single newline. That didn't change with my previous commit, it is an unrelated bug - except that it affects the same line of code. Sometimes, it's amzing how many bugs can feed on how little code. Almost as if one byte of code could nurture up to eight unrelated bugs... Actually, mdoc(7) and man(7) treat vertical spacing before tables differently. mdoc(7) only breaks the line; if you want vertcal spacing, you need an explicit .Pp. man(7), on the other hand, always prints a blank line before a table. Consequently, to fix *this* bug, vertical space handling cannot remain in the table formatter but must be moved to the macro formatters, which the following patch does. Note that the existing comment in the man(7) formatter contradicts both the behaviour of the existing code and the desirable behavour, somewhat like this: i += 2; /* To decrement i, we have to add one. */ The old code was indeed non-obvious because vertical spacing was manipulated in both print_man_node() and term_tbl(). The new code is obvious enough and can speak for itself; it really doesn't need a comment like term_vspace(p); /* Assure a blank line before the table. */ OK? Ingo Index: man_term.c =================================================================== RCS file: /home/cvs/mdocml/mdocml/man_term.c,v retrieving revision 1.168 diff -u -p -r1.168 man_term.c --- man_term.c 30 Jan 2015 22:04:44 -0000 1.168 +++ man_term.c 6 Mar 2015 13:16:39 -0000 @@ -945,12 +945,8 @@ print_man_node(DECL_ARGS) p->flags |= TERMP_NOSPACE; return; case MAN_TBL: - /* - * Tables are preceded by a newline. Then process a - * table line, which will cause line termination, - */ - if (n->span->prev == NULL) - term_newln(p); + if (p->tbl.cols == NULL) + term_vspace(p); term_tbl(p, n->span); return; default: Index: mdoc_term.c =================================================================== RCS file: /home/cvs/mdocml/mdocml/mdoc_term.c,v retrieving revision 1.312 diff -u -p -r1.312 mdoc_term.c --- mdoc_term.c 6 Mar 2015 13:09:07 -0000 1.312 +++ mdoc_term.c 6 Mar 2015 13:16:39 -0000 @@ -348,6 +348,8 @@ print_mdoc_node(DECL_ARGS) p->flags |= TERMP_NOSPACE; break; case MDOC_TBL: + if (p->tbl.cols == NULL) + term_newln(p); term_tbl(p, n->span); break; default: Index: tbl_term.c =================================================================== RCS file: /home/cvs/mdocml/mdocml/tbl_term.c,v retrieving revision 1.39 diff -u -p -r1.39 tbl_term.c --- tbl_term.c 6 Mar 2015 11:03:03 -0000 1.39 +++ tbl_term.c 6 Mar 2015 13:16:39 -0000 @@ -66,9 +66,6 @@ term_tbl(struct termp *tp, const struct size_t rmargin, maxrmargin, tsz; int ic, horiz, spans, vert; - if (tp->tbl.cols == NULL) - term_flushln(tp); - rmargin = tp->rmargin; maxrmargin = tp->maxrmargin; -- To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv