aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/term.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-11-16 21:29:35 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-11-16 21:29:35 +0000
commit194fdd32fe2e8d95e8130915d406a4509ac1caf7 (patch)
tree8ff73a1f945949530d9c791de4911827c17d01fb /term.c
parentb105c57e618a333c213bf981be42c1a5de1e213e (diff)
downloadmandoc-194fdd32fe2e8d95e8130915d406a4509ac1caf7.tar.gz
mandoc-194fdd32fe2e8d95e8130915d406a4509ac1caf7.tar.zst
mandoc-194fdd32fe2e8d95e8130915d406a4509ac1caf7.zip
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 'term.c')
-rw-r--r--term.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/term.c b/term.c
index dc30cca5..085d254b 100644
--- a/term.c
+++ b/term.c
@@ -1,4 +1,4 @@
-/* $Id: term.c,v 1.234 2014/11/01 04:03:49 schwarze Exp $ */
+/* $Id: term.c,v 1.235 2014/11/16 21:29:35 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -254,8 +254,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;