=================================================================== RCS file: /cvs/mandoc/mdoc_term.c,v retrieving revision 1.194 retrieving revision 1.198 diff -u -p -r1.194 -r1.198 --- mandoc/mdoc_term.c 2010/10/23 23:31:10 1.194 +++ mandoc/mdoc_term.c 2010/12/15 23:44:02 1.198 @@ -1,4 +1,4 @@ -/* $Id: mdoc_term.c,v 1.194 2010/10/23 23:31:10 schwarze Exp $ */ +/* $Id: mdoc_term.c,v 1.198 2010/12/15 23:44:02 kristaps Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons * Copyright (c) 2010 Ingo Schwarze @@ -319,9 +319,12 @@ print_mdoc_node(DECL_ARGS) /* * Keeps only work until the end of a line. If a keep was * invoked in a prior line, revert it to PREKEEP. + * + * Also let SYNPRETTY sections behave as if they were wrapped + * in a `Bk' block. */ - if (TERMP_KEEP & p->flags) { + if (TERMP_KEEP & p->flags || MDOC_SYNPRETTY & n->flags) { if (n->prev && n->prev->line != n->line) { p->flags &= ~TERMP_KEEP; p->flags |= TERMP_PREKEEP; @@ -333,6 +336,16 @@ print_mdoc_node(DECL_ARGS) } } + /* + * Since SYNPRETTY sections aren't "turned off" with `Ek', + * we have to intuit whether we should disable formatting. + */ + + if ( ! (MDOC_SYNPRETTY & n->flags) && + ((n->prev && MDOC_SYNPRETTY & n->prev->flags) || + (n->parent && MDOC_SYNPRETTY & n->parent->flags))) + p->flags &= ~(TERMP_KEEP | TERMP_PREKEEP); + if (chld && n->child) print_mdoc_nodelist(p, &npair, m, n->child); @@ -1592,6 +1605,10 @@ termp_bd_pre(DECL_ARGS) /* FALLTHROUGH */ case (MDOC_Bl): /* FALLTHROUGH */ + case (MDOC_D1): + /* FALLTHROUGH */ + case (MDOC_Dl): + /* FALLTHROUGH */ case (MDOC_Lp): /* FALLTHROUGH */ case (MDOC_Pp): @@ -1798,11 +1815,6 @@ termp_sp_pre(DECL_ARGS) len = 0; break; default: - assert(n->parent); - if ((NULL == n->next || NULL == n->prev) && - (MDOC_Ss == n->parent->tok || - MDOC_Sh == n->parent->tok)) - return(0); len = 1; break; } @@ -2076,7 +2088,7 @@ termp_lk_pre(DECL_ARGS) nn = sv = n->child; - if (NULL == nn->next) + if (NULL == nn || NULL == nn->next) return(1); for (nn = nn->next; nn; nn = nn->next)