From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from scc-mailout.scc.kit.edu (scc-mailout.scc.kit.edu [129.13.185.202]) by krisdoz.my.domain (8.14.3/8.14.3) with ESMTP id p8K9C9Uf008411 for ; Tue, 20 Sep 2011 05:12:09 -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 1R5wMx-0001cs-W9; Tue, 20 Sep 2011 11:12:00 +0200 Received: from donnerwolke.usta.de ([172.24.96.3]) by hekate.usta.de with esmtp (Exim 4.72) (envelope-from ) id 1R5wN6-0001vZ-43; Tue, 20 Sep 2011 11:12:08 +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 1R5wN6-0000kV-20; Tue, 20 Sep 2011 11:12:08 +0200 Received: from schwarze by usta.de with local (Exim 4.72) (envelope-from ) id 1R5wN5-0003xO-Nr; Tue, 20 Sep 2011 11:12:07 +0200 Date: Tue, 20 Sep 2011 11:12:07 +0200 From: Ingo Schwarze To: Thomas Klausner Cc: discuss@mdocml.bsd.lv Subject: Re: groff-1.19.2 difference: indent Message-ID: <20110920091207.GA13269@iris.usta.de> References: <20110918162440.GA10245@danbala.tuwien.ac.at> <20110918163225.GF29692@iris.usta.de> <20110919133533.GT10245@danbala.tuwien.ac.at> 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: <20110919133533.GT10245@danbala.tuwien.ac.at> User-Agent: Mutt/1.5.21 (2010-09-15) Hi Thomas, Thomas Klausner wrote on Mon, Sep 19, 2011 at 03:35:33PM +0200: > I tested one of the issues Nicolas found incorrectly, > so here's another unfixed one: > > 1) For long names, you end up with 3 lines (mandoc) instead of one > (nroff). By example curses_default_colors(3) > < CURSES_DEFAULT_COLOR... NetBSD Library Functions ManualCURSES_DEFAULT_COLOR... > --- > > CURSES_DEFAULT_COLORS(3) > > NetBSD Library Functions Manual > > CURSES_DEFAULT_COLORS(3) > > I can't say I like the "..." but three lines is worse in my eyes... Indeed, dropping content just to slavishly adhere to a format where the content won't fit is stupid, so we decided a long time ago that we won't follow groff in this respect. But what mandoc(1) does with mdoc(7) is not nice either; i have now committed a patch to both OpenBSD and bsd.lv to use the same format for mdoc(7) that we had chosen for man(7) - when the title gets too long, it now does this: CURSES_DEFAULT_COLORS(3) NetBSD Library Functions Manual NAME curses_default_colors, assume_default_colors, use_default_colors - curses default colors setting routines Thanks for the reminder, Ingo Log Message: ----------- Sync print_mdoc_head to print_man_head; this was forgotten after man_term.c rev. 1.25 on March 2, 2010. The benefit is a sane page header line when .Dt is very long. Reminded by Thomas Klausner , thanks. Modified Files: -------------- mdocml: man_term.c mdoc_term.c Revision Data ------------- Index: man_term.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man_term.c,v retrieving revision 1.117 retrieving revision 1.118 diff -Lman_term.c -Lman_term.c -u -p -r1.117 -r1.118 --- man_term.c +++ man_term.c @@ -1007,9 +1007,9 @@ print_man_head(struct termp *p, const vo * point we did so here. */ + p->offset = 0; p->rmargin = p->maxrmargin; - p->offset = 0; buf[0] = title[0] = '\0'; if (m->vol) @@ -1019,12 +1019,12 @@ print_man_head(struct termp *p, const vo snprintf(title, BUFSIZ, "%s(%s)", m->title, m->msec); titlen = term_strlen(p, title); + p->flags |= TERMP_NOBREAK | TERMP_NOSPACE; p->offset = 0; p->rmargin = 2 * (titlen+1) + buflen < p->maxrmargin ? (p->maxrmargin - term_strlen(p, buf) + term_len(p, 1)) / 2 : p->maxrmargin - buflen; - p->flags |= TERMP_NOBREAK | TERMP_NOSPACE; term_word(p, title); term_flushln(p); @@ -1046,9 +1046,9 @@ print_man_head(struct termp *p, const vo term_flushln(p); } - p->rmargin = p->maxrmargin; - p->offset = 0; p->flags &= ~TERMP_NOSPACE; + p->offset = 0; + p->rmargin = p->maxrmargin; /* * Groff likes to have some leading spaces before content. Well Index: mdoc_term.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_term.c,v retrieving revision 1.234 retrieving revision 1.235 diff -Lmdoc_term.c -Lmdoc_term.c -u -p -r1.234 -r1.235 --- mdoc_term.c +++ mdoc_term.c @@ -458,13 +458,11 @@ static void print_mdoc_head(struct termp *p, const void *arg) { char buf[BUFSIZ], title[BUFSIZ]; + size_t buflen, titlen; const struct mdoc_meta *m; m = (const struct mdoc_meta *)arg; - p->rmargin = p->maxrmargin; - p->offset = 0; - /* * The header is strange. It has three components, which are * really two with the first duplicated. It goes like this: @@ -478,8 +476,12 @@ print_mdoc_head(struct termp *p, const v * switches on the manual section. */ + p->offset = 0; + p->rmargin = p->maxrmargin; + assert(m->vol); strlcpy(buf, m->vol, BUFSIZ); + buflen = term_strlen(p, buf); if (m->arch) { strlcat(buf, " (", BUFSIZ); @@ -488,33 +490,38 @@ print_mdoc_head(struct termp *p, const v } snprintf(title, BUFSIZ, "%s(%s)", m->title, m->msec); + titlen = term_strlen(p, title); - p->offset = 0; - p->rmargin = (p->maxrmargin - - term_strlen(p, buf) + term_len(p, 1)) / 2; p->flags |= TERMP_NOBREAK | TERMP_NOSPACE; + p->offset = 0; + p->rmargin = 2 * (titlen+1) + buflen < p->maxrmargin ? + (p->maxrmargin - + term_strlen(p, buf) + term_len(p, 1)) / 2 : + p->maxrmargin - buflen; term_word(p, title); term_flushln(p); - p->offset = p->rmargin; - p->rmargin = p->maxrmargin - term_strlen(p, title); p->flags |= TERMP_NOSPACE; + p->offset = p->rmargin; + p->rmargin = p->offset + buflen + titlen < p->maxrmargin ? + p->maxrmargin - titlen : p->maxrmargin; term_word(p, buf); term_flushln(p); - p->offset = p->rmargin; - p->rmargin = p->maxrmargin; p->flags &= ~TERMP_NOBREAK; - p->flags |= TERMP_NOSPACE; - - term_word(p, title); - term_flushln(p); + if (p->rmargin + titlen <= p->maxrmargin) { + p->flags |= TERMP_NOSPACE; + p->offset = p->rmargin; + p->rmargin = p->maxrmargin; + term_word(p, title); + term_flushln(p); + } + p->flags &= ~TERMP_NOSPACE; p->offset = 0; p->rmargin = p->maxrmargin; - p->flags &= ~TERMP_NOSPACE; } -- To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv