=================================================================== RCS file: /cvs/mandoc/mdoc_term.c,v retrieving revision 1.273 retrieving revision 1.280 diff -u -p -r1.273 -r1.280 --- mandoc/mdoc_term.c 2014/07/30 00:19:16 1.273 +++ mandoc/mdoc_term.c 2014/08/21 12:57:17 1.280 @@ -1,4 +1,4 @@ -/* $Id: mdoc_term.c,v 1.273 2014/07/30 00:19:16 schwarze Exp $ */ +/* $Id: mdoc_term.c,v 1.280 2014/08/21 12:57:17 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze @@ -16,9 +16,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#ifdef HAVE_CONFIG_H #include "config.h" -#endif #include @@ -476,7 +474,11 @@ print_mdoc_head(struct termp *p, const void *arg) meta->vol, meta->arch); vollen = term_strlen(p, volume); - mandoc_asprintf(&title, "%s(%s)", meta->title, meta->msec); + if (NULL == meta->msec) + title = mandoc_strdup(meta->title); + else + mandoc_asprintf(&title, "%s(%s)", + meta->title, meta->msec); titlen = term_strlen(p, title); p->flags |= TERMP_NOBREAK | TERMP_NOSPACE; @@ -804,7 +806,8 @@ termp_it_pre(DECL_ARGS) * the "overstep" effect in term_flushln() and treat * this as a `-ohang' list instead. */ - if (n->next->child && + if (NULL != n->next && + NULL != n->next->child && (MDOC_Bl == n->next->child->tok || MDOC_Bd == n->next->child->tok)) break; @@ -860,7 +863,9 @@ termp_it_pre(DECL_ARGS) * don't want to recalculate rmargin and offsets when * using `Bd' or `Bl' within `-hang' overstep lists. */ - if (MDOC_HEAD == n->type && n->next->child && + if (MDOC_HEAD == n->type && + NULL != n->next && + NULL != n->next->child && (MDOC_Bl == n->next->child->tok || MDOC_Bd == n->next->child->tok)) break; @@ -1025,7 +1030,8 @@ termp_nm_pre(DECL_ARGS) if (MDOC_HEAD == n->type) synopsis_pre(p, n->parent); - if (MDOC_HEAD == n->type && n->next->child) { + if (MDOC_HEAD == n->type && + NULL != n->next && NULL != n->next->child) { p->flags |= TERMP_NOSPACE | TERMP_NOBREAK | TERMP_BRIND; p->trailspace = 1; p->rmargin = p->offset + term_len(p, 1); @@ -1053,7 +1059,8 @@ termp_nm_post(DECL_ARGS) if (MDOC_BLOCK == n->type) { p->flags &= ~(TERMP_KEEP | TERMP_PREKEEP); - } else if (MDOC_HEAD == n->type && n->next->child) { + } else if (MDOC_HEAD == n->type && + NULL != n->next && NULL != n->next->child) { term_flushln(p); p->flags &= ~(TERMP_NOBREAK | TERMP_BRIND | TERMP_HANG); p->trailspace = 0; @@ -1068,10 +1075,11 @@ termp_fl_pre(DECL_ARGS) term_fontpush(p, TERMFONT_BOLD); term_word(p, "\\-"); - if (n->child) + if ( ! (n->nchild == 0 && + (n->next == NULL || + n->next->type == MDOC_TEXT || + n->next->flags & MDOC_LINE))) p->flags |= TERMP_NOSPACE; - else if (n->next && n->next->line == n->line) - p->flags |= TERMP_NOSPACE; return(1); } @@ -1770,6 +1778,9 @@ termp_ss_pre(DECL_ARGS) term_fontpush(p, TERMFONT_BOLD); p->offset = term_len(p, (p->defindent+1)/2); break; + case MDOC_BODY: + p->offset = term_len(p, p->defindent); + break; default: break; } @@ -1781,7 +1792,7 @@ static void termp_ss_post(DECL_ARGS) { - if (MDOC_HEAD == n->type) + if (n->type == MDOC_HEAD || n->type == MDOC_BODY) term_newln(p); }