From c07ce3d2bf22fef2ebb9ae3292c5bce3c0cd2e4c Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Wed, 21 Sep 2011 09:57:12 +0000 Subject: 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. --- usr.bin/mandoc/man_term.c | 8 +++----- 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 * Copyright (c) 2010, 2011 Ingo Schwarze @@ -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 * Copyright (c) 2010, 2011 Ingo Schwarze @@ -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. */ -- cgit v1.2.3