diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2011-09-21 09:57:12 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2011-09-21 09:57:12 +0000 |
commit | c07ce3d2bf22fef2ebb9ae3292c5bce3c0cd2e4c (patch) | |
tree | 62edf8fc13ec8a02ff91a81f727837114499b2c6 | |
parent | 459cf1446f1965c5289fc9ae69176173a4fc16f0 (diff) |
As noticed by kristaps@, when breaking an overflowing line,
forget about pending whitespace (vbl), or the next line would
be misaligned and potentially too long; but i'm fixing this
in a simpler way than he proposed.
Also remove the kludges in .HP that compensated for this bug.
-rw-r--r-- | usr.bin/mandoc/man_term.c | 8 | ||||
-rw-r--r-- | usr.bin/mandoc/term.c | 10 |
2 files changed, 7 insertions, 11 deletions
diff --git a/usr.bin/mandoc/man_term.c b/usr.bin/mandoc/man_term.c index a7687312058..a616ebd511e 100644 --- a/usr.bin/mandoc/man_term.c +++ b/usr.bin/mandoc/man_term.c @@ -1,4 +1,4 @@ -/* $Id: man_term.c,v 1.75 2011/09/20 14:20:47 schwarze Exp $ */ +/* $Id: man_term.c,v 1.76 2011/09/21 09:57:11 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org> @@ -247,7 +247,7 @@ pre_literal(DECL_ARGS) * indentation has to be set up explicitly. */ if (MAN_HP == n->parent->tok && p->rmargin < p->maxrmargin) { - p->offset = p->rmargin + 1; + p->offset = p->rmargin; p->rmargin = p->maxrmargin; p->flags &= ~(TERMP_NOBREAK | TERMP_TWOSPACE); p->flags |= TERMP_NOSPACE; @@ -465,9 +465,7 @@ pre_HP(DECL_ARGS) len = (size_t)ival; one = term_len(p, 1); - if (len > one) - len -= one; - else + if (len < one) len = one; p->offset = mt->offset; diff --git a/usr.bin/mandoc/term.c b/usr.bin/mandoc/term.c index e4b3c95c60e..075eb2b0a8a 100644 --- a/usr.bin/mandoc/term.c +++ b/usr.bin/mandoc/term.c @@ -1,4 +1,4 @@ -/* $Id: term.c,v 1.61 2011/09/19 22:36:11 schwarze Exp $ */ +/* $Id: term.c,v 1.62 2011/09/21 09:57:11 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org> @@ -180,14 +180,12 @@ term_flushln(struct termp *p) if (vend > bp && 0 == jhy && vis > 0) { vend -= vis; (*p->endline)(p); + p->viscol = 0; if (TERMP_NOBREAK & p->flags) { - p->viscol = p->rmargin; - (*p->advance)(p, p->rmargin); + vbl = p->rmargin; vend += p->rmargin - p->offset; - } else { - p->viscol = 0; + } else vbl = p->offset; - } /* Remove the p->overstep width. */ |