summaryrefslogtreecommitdiffstats
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
commit3c5734925c52ae38922a5f660600de0e47c5d4c2 (patch)
treedcbc18d3456f94b3f6b0277be23116b7a8351fbb /mdoc_term.c
parent8dd3b9f7294348a23cb6fb0fbc2bd134814f554f (diff)
downloadmandoc-3c5734925c52ae38922a5f660600de0e47c5d4c2.tar.gz
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.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/mdoc_term.c b/mdoc_term.c
index c04587eb..9acd6f06 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -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);