From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp1.rz.uni-karlsruhe.de (Debian-exim@smtp1.rz.uni-karlsruhe.de [129.13.185.217]) by krisdoz.my.domain (8.14.3/8.14.3) with ESMTP id o8MKc679004833 for ; Wed, 22 Sep 2010 16:38:08 -0400 (EDT) Received: from hekate.usta.de (asta-nat.asta.uni-karlsruhe.de [172.22.63.82]) by smtp1.rz.uni-karlsruhe.de with esmtp (Exim 4.63 #1) id 1OyW4r-00033p-6p; Wed, 22 Sep 2010 22:38:05 +0200 Received: from donnerwolke.usta.de ([172.24.96.3]) by hekate.usta.de with esmtp (Exim 4.71) (envelope-from ) id 1OyW4r-0005Hz-5H for discuss@mdocml.bsd.lv; Wed, 22 Sep 2010 22:38:05 +0200 Received: from iris.usta.de ([172.24.96.5] helo=usta.de) by donnerwolke.usta.de with esmtp (Exim 4.69) (envelope-from ) id 1OyW4r-00035R-4J for discuss@mdocml.bsd.lv; Wed, 22 Sep 2010 22:38:05 +0200 Received: from schwarze by usta.de with local (Exim 4.71) (envelope-from ) id 1OyW4q-0001Bx-U9 for discuss@mdocml.bsd.lv; Wed, 22 Sep 2010 22:38:04 +0200 Date: Wed, 22 Sep 2010 22:38:04 +0200 From: Ingo Schwarze To: discuss@mdocml.bsd.lv Subject: Re: genassym.sh(8) SYNOPSIS oops Message-ID: <20100922203804.GB15325@iris.usta.de> References: <20100922135020.GA11871@bramka.kerhand.co.uk> X-Mailinglist: mdocml-discuss Reply-To: discuss@mdocml.bsd.lv MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100922135020.GA11871@bramka.kerhand.co.uk> User-Agent: Mutt/1.5.20 (2009-06-14) Hi Jason, Jason McIntyre wrote on Wed, Sep 22, 2010 at 02:49:56PM +0059: > source: > > .Sh SYNOPSIS > .Nm sh genassym.sh > .Op Fl c > .Ar C compiler invocation > > groff: > > SYNOPSIS > sh genassym.sh [-c] C compiler invocation Gah. When .Nm has more than one head argument in block mode, groff uses only one of the arguments to calculate the indentation, then uses -hang mode indeed to accomodate the fact that the head is actually wider than the chosen indentation. Old groff 1.15 uses the width of the *last* argument as the indentation, which usually looks ugly. New groff 1.20.1 uses the width of the *first* argument instead, which clearly looks better, because the second, indented line aligns with the second word of the .Nm. I suggest to follow groff 1.20.1 behaviour, so we need -hang mode if and only if the .Nm block head has more than one child. See below for an updated patch. The test(1) and vi(1) pages still look fine as well. > mandoc: > > sh genassym.sh > [-c] C compiler invocation > > this is with ingo's last patch (the one that made vi work). > some regression? Indeed, good catch, thanks! Yours, Ingo Index: mdoc_term.c =================================================================== RCS file: /cvs/src/usr.bin/mandoc/mdoc_term.c,v retrieving revision 1.104 diff -u -p -r1.104 mdoc_term.c --- mdoc_term.c 20 Sep 2010 20:02:27 -0000 1.104 +++ mdoc_term.c 22 Sep 2010 20:33:26 -0000 @@ -1027,12 +1027,18 @@ termp_nm_pre(DECL_ARGS) synopsis_pre(p, n->parent); if (MDOC_HEAD == n->type && n->next->child) { - p->flags |= TERMP_NOSPACE | TERMP_NOBREAK | TERMP_HANG; - p->rmargin = p->offset + term_len(p, 1) + - (NULL == n->child ? term_strlen(p, m->name) : - MDOC_TEXT == n->child->type ? - term_strlen(p, n->child->string) : - term_len(p, 5)); + p->flags |= TERMP_NOSPACE | TERMP_NOBREAK; + p->rmargin = p->offset + term_len(p, 1); + if (NULL == n->child) { + p->rmargin += term_strlen(p, m->name); + } else if (MDOC_TEXT == n->child->type) { + p->rmargin += term_strlen(p, n->child->string); + if (n->child->next) + p->flags |= TERMP_HANG; + } else { + p->rmargin += term_len(p, 5); + p->flags |= TERMP_HANG; + } } term_fontpush(p, TERMFONT_BOLD); Index: term.c =================================================================== RCS file: /cvs/src/usr.bin/mandoc/term.c,v retrieving revision 1.50 diff -u -p -r1.50 term.c --- term.c 21 Sep 2010 22:33:41 -0000 1.50 +++ term.c 22 Sep 2010 20:33:28 -0000 @@ -1,4 +1,4 @@ -/* $Id: term.c,v 1.50 2010/09/21 22:33:41 schwarze Exp $ */ +/* $Id: term.c,v 1.49 2010/08/20 23:34:00 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons * Copyright (c) 2010 Ingo Schwarze @@ -130,6 +130,7 @@ term_flushln(struct termp *p) size_t vbl; /* number of blanks to prepend to output */ size_t vend; /* end of word visual position on output */ size_t bp; /* visual right border position */ + size_t dv; /* temporary for visual pos calculations */ int j; /* temporary loop index for p->buf */ int jhy; /* last hyph before overflow w/r/t j */ size_t maxvis; /* output position of visible boundary */ @@ -233,7 +234,9 @@ term_flushln(struct termp *p) j = i; while (' ' == p->buf[i]) i++; - vbl += (i - j) * (*p->width)(p, ' '); + dv = (i - j) * (*p->width)(p, ' '); + vbl += dv; + vend += dv; break; } if (ASCII_NBRSP == p->buf[i]) { @@ -260,7 +263,6 @@ term_flushln(struct termp *p) p->viscol += (*p->width)(p, p->buf[i]); } } - vend += vbl; vis = vend; } -- To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv