summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-07-06 10:54:05 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-07-06 10:54:05 +0000
commita3dd505d1797e21daabbbddcb9843e8c0682ab5e (patch)
tree630e63cae289a46f5ab624375325a95f9ea54fa5
parent2d53479241546a875b9c64ec79c28fd821060f87 (diff)
downloadmandoc-a3dd505d1797e21daabbbddcb9843e8c0682ab5e.tar.gz
mandoc-a3dd505d1797e21daabbbddcb9843e8c0682ab5e.tar.zst
mandoc-a3dd505d1797e21daabbbddcb9843e8c0682ab5e.zip
Proper `Bk -words' support: only suppress breaks within a line, but
allow end-of-line to break. This fixes the bad behaviour found when macros within `Bk' never break. "Excellent" schwarze@
-rw-r--r--mdoc_term.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/mdoc_term.c b/mdoc_term.c
index cdad7fb5..41bdf128 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_term.c,v 1.171 2010/07/04 22:04:04 schwarze Exp $ */
+/* $Id: mdoc_term.c,v 1.172 2010/07/06 10:54:05 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
@@ -330,6 +330,23 @@ print_mdoc_node(DECL_ARGS)
else if (termacts[n->tok].pre && ENDBODY_NOT == n->end)
chld = (*termacts[n->tok].pre)(p, &npair, m, n);
+ /*
+ * Keeps only work until the end of a line. If a keep was
+ * invoked in a prior line, revert it to PREKEEP.
+ */
+
+ if (TERMP_KEEP & p->flags) {
+ if (n->prev && n->prev->line != n->line) {
+ p->flags &= ~TERMP_KEEP;
+ p->flags |= TERMP_PREKEEP;
+ } else if (NULL == n->prev) {
+ if (n->parent && n->parent->line != n->line) {
+ p->flags &= ~TERMP_KEEP;
+ p->flags |= TERMP_PREKEEP;
+ }
+ }
+ }
+
if (chld && n->child)
print_mdoc_nodelist(p, &npair, m, n->child);