From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from localhost (fantadrom.bsd.lv [local]); by fantadrom.bsd.lv (OpenSMTPD) with ESMTPA id 40949c9f; for ; Mon, 21 Sep 2015 08:25:30 -0500 (EST) Date: Mon, 21 Sep 2015 08:25:30 -0500 (EST) Message-Id: <1842925956745737989.enqueue@fantadrom.bsd.lv> X-Mailinglist: mdocml-source Reply-To: source@mdocml.bsd.lv MIME-Version: 1.0 From: schwarze@mdocml.bsd.lv To: source@mdocml.bsd.lv Subject: mdocml: Trailing whitespace is significant when determining the width of X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Log Message: ----------- Trailing whitespace is significant when determining the width of a tag in mdoc(7) .Bl -tag and man(7) .TP, but not in man(7) .IP. Quirk reported by Jan Stary on ports@. Modified Files: -------------- mdocml: man_term.c mdoc_term.c term.c term.h Revision Data ------------- Index: term.c =================================================================== RCS file: /home/cvs/mdocml/mdocml/term.c,v retrieving revision 1.249 retrieving revision 1.250 diff -Lterm.c -Lterm.c -u -p -r1.249 -r1.250 --- term.c +++ term.c @@ -78,6 +78,8 @@ term_end(struct termp *p) * the next column. However, if less than p->trailspace blanks, * which can be 0, 1, or 2, remain to the right margin, the line * will be broken. + * - TERMP_BRTRSP: Consider trailing whitespace significant + * when deciding whether the chunk fits or not. * - TERMP_BRIND: If the chunk does not fit and the output line has * to be broken, start the next line at the right margin instead * of at the offset. Used together with TERMP_NOBREAK for the tags @@ -290,6 +292,10 @@ term_flushln(struct termp *p) } else if (TERMP_DANGLE & p->flags) return; + + /* Trailing whitespace is significant in some columns. */ + if (vis && vbl && (TERMP_BRTRSP & p->flags)) + vis += vbl; /* If the column was overrun, break the line. */ if (maxvis < vis + p->trailspace * (*p->width)(p, ' ')) { Index: term.h =================================================================== RCS file: /home/cvs/mdocml/mdocml/term.h,v retrieving revision 1.115 retrieving revision 1.116 diff -Lterm.h -Lterm.h -u -p -r1.115 -r1.116 --- term.h +++ term.h @@ -77,12 +77,13 @@ struct termp { #define TERMP_BACKAFTER (1 << 6) /* Back up after next character. */ #define TERMP_BACKBEFORE (1 << 7) /* Back up before next character. */ #define TERMP_NOBREAK (1 << 8) /* See term_flushln(). */ -#define TERMP_BRIND (1 << 9) /* See term_flushln(). */ -#define TERMP_DANGLE (1 << 10) /* See term_flushln(). */ -#define TERMP_HANG (1 << 11) /* See term_flushln(). */ -#define TERMP_NOSPLIT (1 << 12) /* Do not break line before .An. */ -#define TERMP_SPLIT (1 << 13) /* Break line before .An. */ -#define TERMP_NONEWLINE (1 << 14) /* No line break in nofill mode. */ +#define TERMP_BRTRSP (1 << 9) /* See term_flushln(). */ +#define TERMP_BRIND (1 << 10) /* See term_flushln(). */ +#define TERMP_DANGLE (1 << 11) /* See term_flushln(). */ +#define TERMP_HANG (1 << 12) /* See term_flushln(). */ +#define TERMP_NOSPLIT (1 << 13) /* Do not break line before .An. */ +#define TERMP_SPLIT (1 << 14) /* Break line before .An. */ +#define TERMP_NONEWLINE (1 << 15) /* No line break in nofill mode. */ int *buf; /* Output buffer. */ enum termenc enc; /* Type of encoding. */ const struct mchars *symtab; /* Character table. */ Index: man_term.c =================================================================== RCS file: /home/cvs/mdocml/mdocml/man_term.c,v retrieving revision 1.183 retrieving revision 1.184 diff -Lman_term.c -Lman_term.c -u -p -r1.183 -r1.184 --- man_term.c +++ man_term.c @@ -671,7 +671,7 @@ pre_TP(DECL_ARGS) switch (n->type) { case ROFFT_HEAD: - p->flags |= TERMP_NOBREAK; + p->flags |= TERMP_NOBREAK | TERMP_BRTRSP; p->trailspace = 1; break; case ROFFT_BODY: @@ -723,7 +723,7 @@ pre_TP(DECL_ARGS) p->offset = mt->offset + len; p->rmargin = p->maxrmargin; p->trailspace = 0; - p->flags &= ~TERMP_NOBREAK; + p->flags &= ~(TERMP_NOBREAK | TERMP_BRTRSP); break; default: break; Index: mdoc_term.c =================================================================== RCS file: /home/cvs/mdocml/mdocml/mdoc_term.c,v retrieving revision 1.325 retrieving revision 1.326 diff -Lmdoc_term.c -Lmdoc_term.c -u -p -r1.325 -r1.326 --- mdoc_term.c +++ mdoc_term.c @@ -802,7 +802,7 @@ termp_it_pre(DECL_ARGS) if (n->type != ROFFT_HEAD) break; - p->flags |= TERMP_NOBREAK | TERMP_BRIND; + p->flags |= TERMP_NOBREAK | TERMP_BRTRSP | TERMP_BRIND; p->trailspace = 2; if (NULL == n->next || NULL == n->next->child) @@ -974,7 +974,7 @@ termp_it_post(DECL_ARGS) * has munged them in the meanwhile. */ - p->flags &= ~(TERMP_NOBREAK | TERMP_BRIND | + p->flags &= ~(TERMP_NOBREAK | TERMP_BRTRSP | TERMP_BRIND | TERMP_DANGLE | TERMP_HANG); p->trailspace = 0; } -- To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv