From d52d7fb0d050a05e50c02fcc2c863317c4da1c8e Mon Sep 17 00:00:00 2001 From: schwarze Date: Wed, 4 Aug 2010 18:52:55 +0000 Subject: [PATCH] In .Bd -literal, break the output line after the last element of each input line, not after the first element. Since free-form text lines only have a single element in literal mode, this is only relevant for macro lines inside literal displays, and only for those containing more than one macro. Fixes e.g. awk(1) and boot_config(8). Note this fix differs from what kristaps@ committed to bsd.lv because those changes introduce regressions with respect to blank lines in literal mode. With permission from deraadt@ to still fix bugs in mandoc. --- usr.bin/mandoc/mdoc_term.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/usr.bin/mandoc/mdoc_term.c b/usr.bin/mandoc/mdoc_term.c index b7a7b23977f..951fc4ebe00 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.99 2010/07/31 21:43:07 schwarze Exp $ */ +/* $Id: mdoc_term.c,v 1.100 2010/08/04 18:52:55 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons * Copyright (c) 2010 Ingo Schwarze @@ -1649,12 +1649,11 @@ termp_bd_pre(DECL_ARGS) p->rmargin = p->maxrmargin = TERM_MAXMARGIN; for (nn = n->child; nn; nn = nn->next) { - p->flags |= TERMP_NOSPACE; print_mdoc_node(p, pair, m, nn); - if (NULL == nn->prev || - nn->prev->line < nn->line || - NULL == nn->next) - term_flushln(p); + if (nn->next && nn->next->line == nn->line) + continue; + term_flushln(p); + p->flags |= TERMP_NOSPACE; } p->tabwidth = tabwidth; -- 2.20.1