From 39734eb01d30f4fff1da35538dbe086698bf9d43 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Tue, 9 May 2017 14:10:01 +0000 Subject: Trailing \c suppresses the output line break even if the next line is a text line starting with whitespace. Quirk found in the sysutils/rancid port. --- man_html.c | 5 +++-- man_term.c | 7 ++++--- mdoc_html.c | 8 ++++---- mdoc_term.c | 5 +++-- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/man_html.c b/man_html.c index 2a071085..87c6372b 100644 --- a/man_html.c +++ b/man_html.c @@ -1,4 +1,4 @@ -/* $Id: man_html.c,v 1.141 2017/05/05 15:17:32 schwarze Exp $ */ +/* $Id: man_html.c,v 1.142 2017/05/09 14:10:01 schwarze Exp $ */ /* * Copyright (c) 2008-2012, 2014 Kristaps Dzonsons * Copyright (c) 2013, 2014, 2015, 2017 Ingo Schwarze @@ -251,7 +251,8 @@ print_man_node(MAN_ARGS) case ROFFT_TEXT: if (fillmode(h, want_fillmode) == MAN_fi && want_fillmode == MAN_fi && - n->flags & NODE_LINE && *n->string == ' ') + n->flags & NODE_LINE && *n->string == ' ' && + (h->flags & HTML_NONEWLINE) == 0) print_otag(h, TAG_BR, ""); if (*n->string != '\0') break; diff --git a/man_term.c b/man_term.c index b902184a..b090bc43 100644 --- a/man_term.c +++ b/man_term.c @@ -1,4 +1,4 @@ -/* $Id: man_term.c,v 1.199 2017/05/07 21:44:49 schwarze Exp $ */ +/* $Id: man_term.c,v 1.200 2017/05/09 14:10:01 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010-2015, 2017 Ingo Schwarze @@ -873,10 +873,11 @@ print_man_node(DECL_ARGS) * If we have a space as the first character, break * before printing the line's data. */ - if ('\0' == *n->string) { + if (*n->string == '\0') { term_vspace(p); return; - } else if (' ' == *n->string && NODE_LINE & n->flags) + } else if (*n->string == ' ' && n->flags & NODE_LINE && + (p->flags & TERMP_NONEWLINE) == 0) term_newln(p); term_word(p, n->string); diff --git a/mdoc_html.c b/mdoc_html.c index 9819c2ff..2ad35035 100644 --- a/mdoc_html.c +++ b/mdoc_html.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_html.c,v 1.285 2017/05/05 15:17:32 schwarze Exp $ */ +/* $Id: mdoc_html.c,v 1.286 2017/05/09 14:10:01 schwarze Exp $ */ /* * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons * Copyright (c) 2014, 2015, 2016, 2017 Ingo Schwarze @@ -359,9 +359,9 @@ print_mdoc_node(MDOC_ARGS) * Make sure that if we're in a literal mode already * (i.e., within a
) don't print the newline.
 		 */
-		if (' ' == *n->string && NODE_LINE & n->flags)
-			if ( ! (HTML_LITERAL & h->flags))
-				print_otag(h, TAG_BR, "");
+		if (*n->string == ' ' && n->flags & NODE_LINE &&
+		    (h->flags & (HTML_LITERAL | HTML_NONEWLINE)) == 0)
+			print_otag(h, TAG_BR, "");
 		if (NODE_DELIMC & n->flags)
 			h->flags |= HTML_NOSPACE;
 		print_text(h, n->string);
diff --git a/mdoc_term.c b/mdoc_term.c
index 08620365..e4c0b92c 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -1,4 +1,4 @@
-/*	$Id: mdoc_term.c,v 1.356 2017/05/07 17:31:45 schwarze Exp $ */
+/*	$Id: mdoc_term.c,v 1.357 2017/05/09 14:10:01 schwarze Exp $ */
 /*
  * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons 
  * Copyright (c) 2010, 2012-2017 Ingo Schwarze 
@@ -342,7 +342,8 @@ print_mdoc_node(DECL_ARGS)
 
 	switch (n->type) {
 	case ROFFT_TEXT:
-		if (' ' == *n->string && NODE_LINE & n->flags)
+		if (*n->string == ' ' && n->flags & NODE_LINE &&
+		    (p->flags & TERMP_NONEWLINE) == 0)
 			term_newln(p);
 		if (NODE_DELIMC & n->flags)
 			p->flags |= TERMP_NOSPACE;
-- 
cgit v1.2.3-56-ge451