summaryrefslogtreecommitdiffstats
path: root/mdoc_term.c
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
commitd602633ae86db6d0f89ec77701b98f9d493a376d (patch)
treee629f9ac458dc63f6a8cbb51f8a6dd01ea603b05 /mdoc_term.c
parentfe1a53038c9903e07bd970d56c84c38cf91ae7ab (diff)
downloadmandoc-d602633ae86db6d0f89ec77701b98f9d493a376d.tar.gz
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@
Diffstat (limited to 'mdoc_term.c')
-rw-r--r--mdoc_term.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/mdoc_term.c b/mdoc_term.c
index 4d9b88ae..cb60e5cd 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -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);