aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/term.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2015-09-21 13:25:00 +0000
committerIngo Schwarze <schwarze@openbsd.org>2015-09-21 13:25:00 +0000
commit5eefcc0ad149d57654c561b480f1cbea05f7cbd6 (patch)
treec2988f69f7e0c03237e09ede94998fa2f2de8ba7 /term.c
parent7ce71c9cfb7ce01719940fa18194a4b7c6834509 (diff)
downloadmandoc-5eefcc0ad149d57654c561b480f1cbea05f7cbd6.tar.gz
mandoc-5eefcc0ad149d57654c561b480f1cbea05f7cbd6.tar.zst
mandoc-5eefcc0ad149d57654c561b480f1cbea05f7cbd6.zip
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 <hans at stare dot cz> on ports@.
Diffstat (limited to 'term.c')
-rw-r--r--term.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/term.c b/term.c
index 7070d09b..559f6caa 100644
--- a/term.c
+++ b/term.c
@@ -1,4 +1,4 @@
-/* $Id: term.c,v 1.249 2015/08/30 21:10:56 schwarze Exp $ */
+/* $Id: term.c,v 1.250 2015/09/21 13:25:00 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -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
@@ -291,6 +293,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, ' ')) {
(*p->endline)(p);