summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2014-11-16 21:29:28 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2014-11-16 21:29:28 +0000
commitf116a4618a1b09e77ce11f38621db46dc0320daa (patch)
tree3f2d86520c79407136a2373b0e4930d6665dcb40 /usr.bin/mandoc
parent56b7257d2aff5d970d033e895080664dbe028674 (diff)
When a line (in the sense of term_flushln()) contains white space only,
the `vbl' variable includes the left margin, but `vis' does not. Prevent a `vis' underflow that caused a bogus blank line. Bug reported by Carsten Kunze, found in less(1): .Bl -tag ... .It " "
Diffstat (limited to 'usr.bin/mandoc')
-rw-r--r--usr.bin/mandoc/term.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/mandoc/term.c b/usr.bin/mandoc/term.c
index 8ff50bf20aa..add5ec877cc 100644
--- a/usr.bin/mandoc/term.c
+++ b/usr.bin/mandoc/term.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: term.c,v 1.94 2014/11/01 04:03:22 schwarze Exp $ */
+/* $OpenBSD: term.c,v 1.95 2014/11/16 21:29:27 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -252,8 +252,10 @@ term_flushln(struct termp *p)
* If there was trailing white space, it was not printed;
* so reset the cursor position accordingly.
*/
- if (vis)
+ if (vis > vbl)
vis -= vbl;
+ else
+ vis = 0;
p->col = 0;
p->overstep = 0;