From 5e691b5d0facb330b3a319d6a6a4fde22d71e79b Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Mon, 12 Apr 2010 22:52:20 +0000 Subject: Partial revert of term.c rev. 1.23 because jmc@ noticed that it broke blank lines in literal displays. The original idea was to suppress stray blank lines. But we don't want to suppress *all* blank lines, instead just those caused by nested lists. So do the check whether there was any output on this line, i.e. whether or not to break the line, at the right place, which is after processing the .It body. --- usr.bin/mandoc/mdoc_term.c | 6 +++--- usr.bin/mandoc/term.c | 9 ++------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/usr.bin/mandoc/mdoc_term.c b/usr.bin/mandoc/mdoc_term.c index 7753102eb35..7b744c589d4 100644 --- a/usr.bin/mandoc/mdoc_term.c +++ b/usr.bin/mandoc/mdoc_term.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_term.c,v 1.73 2010/04/07 23:15:05 schwarze Exp $ */ +/* $Id: mdoc_term.c,v 1.74 2010/04/12 22:52:19 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -1020,14 +1020,14 @@ termp_it_post(DECL_ARGS) /* FALLTHROUGH */ case (MDOC_Inset): if (MDOC_BODY == n->type) - term_flushln(p); + term_newln(p); break; case (MDOC_Column): if (MDOC_HEAD == n->type) term_flushln(p); break; default: - term_flushln(p); + term_newln(p); break; } diff --git a/usr.bin/mandoc/term.c b/usr.bin/mandoc/term.c index 9ab9b693bd6..0947d5183d0 100644 --- a/usr.bin/mandoc/term.c +++ b/usr.bin/mandoc/term.c @@ -1,4 +1,4 @@ -/* $Id: term.c,v 1.27 2010/04/07 23:15:05 schwarze Exp $ */ +/* $Id: term.c,v 1.28 2010/04/12 22:52:19 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -130,7 +130,6 @@ term_flushln(struct termp *p) int j; /* temporary loop index */ int jhy; /* last hyphen before line overflow */ size_t maxvis, mmax; - static int line_started = 0; /* * First, establish the maximum columns of "visible" content. @@ -202,7 +201,6 @@ term_flushln(struct termp *p) /* LINTED */ for (j = 0; j < (int)p->offset; j++) putchar(' '); - line_started = 1; /* * Find out whether we would exceed the right margin. @@ -251,10 +249,7 @@ term_flushln(struct termp *p) p->overstep = 0; if ( ! (TERMP_NOBREAK & p->flags)) { - if (line_started) { - putchar('\n'); - line_started = 0; - } + putchar('\n'); return; } -- cgit v1.2.3