aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_term.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-09-27 11:21:39 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-09-27 11:21:39 +0000
commit1bb462fa770edbf91f52a725195dec2abb9da0c0 (patch)
tree8836eba4698722c4e61dbb451973e6dc398e6abe /mdoc_term.c
parentcf31a5f8f71af20edc5dc3b30932e2ba7d10a298 (diff)
downloadmandoc-1bb462fa770edbf91f52a725195dec2abb9da0c0.tar.gz
mandoc-1bb462fa770edbf91f52a725195dec2abb9da0c0.tar.zst
mandoc-1bb462fa770edbf91f52a725195dec2abb9da0c0.zip
Suppress whitespace following Pp, Lp, sp, and the other newline-emitting
macros within an unfilled or literal `Bd'.
Diffstat (limited to 'mdoc_term.c')
-rw-r--r--mdoc_term.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/mdoc_term.c b/mdoc_term.c
index 5df90460..d57eacd9 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_term.c,v 1.189 2010/09/26 10:00:42 kristaps Exp $ */
+/* $Id: mdoc_term.c,v 1.190 2010/09/27 11:21:39 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
@@ -1578,6 +1578,26 @@ termp_bd_pre(DECL_ARGS)
for (nn = n->child; nn; nn = nn->next) {
print_mdoc_node(p, pair, m, nn);
+ /*
+ * If the printed node flushes its own line, then we
+ * needn't do it here as well. This is hacky, but the
+ * notion of selective eoln whitespace is pretty dumb
+ * anyway, so don't sweat it.
+ */
+ switch (nn->tok) {
+ case (MDOC_br):
+ /* FALLTHROUGH */
+ case (MDOC_sp):
+ /* FALLTHROUGH */
+ case (MDOC_Bl):
+ /* FALLTHROUGH */
+ case (MDOC_Lp):
+ /* FALLTHROUGH */
+ case (MDOC_Pp):
+ continue;
+ default:
+ break;
+ }
if (nn->next && nn->next->line == nn->line)
continue;
term_flushln(p);