=================================================================== RCS file: /cvs/mandoc/mdoc_term.c,v retrieving revision 1.38 retrieving revision 1.39 diff -u -p -r1.38 -r1.39 --- mandoc/mdoc_term.c 2009/07/13 07:23:07 1.38 +++ mandoc/mdoc_term.c 2009/07/14 15:17:25 1.39 @@ -1,4 +1,4 @@ -/* $Id: mdoc_term.c,v 1.38 2009/07/13 07:23:07 kristaps Exp $ */ +/* $Id: mdoc_term.c,v 1.39 2009/07/14 15:17:25 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -700,7 +700,7 @@ termp_it_pre(DECL_ARGS) { const struct mdoc_node *bl, *n; char buf[7]; - int i, type, keys[3], vals[3], sv; + int i, type, keys[3], vals[3]; size_t width, offset; if (MDOC_BLOCK == node->type) @@ -769,7 +769,9 @@ termp_it_pre(DECL_ARGS) width = 5; break; case (MDOC_Hang): - /* FALLTHROUGH */ + if (0 == width) + width = 8; + break; case (MDOC_Tag): if (0 == width) width = 10; @@ -787,8 +789,6 @@ termp_it_pre(DECL_ARGS) case (MDOC_Diag): term_word(p, "\\ "); /* FALLTHROUGH */ - case (MDOC_Hang): - /* FALLTHROUGH */ case (MDOC_Inset): if (MDOC_BODY == node->type) p->flags &= ~TERMP_NOSPACE; @@ -829,22 +829,30 @@ termp_it_pre(DECL_ARGS) case (MDOC_Enum): /* FALLTHROUGH */ case (MDOC_Hyphen): - /* FALLTHROUGH */ + if (MDOC_HEAD == node->type) + p->flags |= TERMP_NOBREAK; + else + p->flags |= TERMP_NOLPAD; + break; case (MDOC_Hang): - /* FALLTHROUGH */ + if (MDOC_HEAD == node->type) + p->flags |= TERMP_NOBREAK; + else + p->flags |= TERMP_NOLPAD; + + if (MDOC_HEAD == node->type) + p->flags |= TERMP_HANG; + break; case (MDOC_Tag): if (MDOC_HEAD == node->type) p->flags |= TERMP_NOBREAK; else p->flags |= TERMP_NOLPAD; - if (MDOC_HEAD == node->type && MDOC_Hang == type) - p->flags |= TERMP_NONOBREAK; - - if (MDOC_HEAD == node->type && MDOC_Tag == type) - if (NULL == node->next || - NULL == node->next->child) - p->flags |= TERMP_NONOBREAK; + if (MDOC_HEAD != node->type) + break; + if (NULL == node->next || NULL == node->next->child) + p->flags |= TERMP_DANGLE; break; case (MDOC_Column): if (MDOC_HEAD == node->type) { @@ -902,18 +910,19 @@ termp_it_pre(DECL_ARGS) * HEAD character (temporarily bold, in some cases). */ - sv = p->flags; if (MDOC_HEAD == node->type) switch (type) { case (MDOC_Bullet): p->flags |= TERMP_BOLD; term_word(p, "\\[bu]"); + p->flags &= ~TERMP_BOLD; break; case (MDOC_Dash): /* FALLTHROUGH */ case (MDOC_Hyphen): p->flags |= TERMP_BOLD; term_word(p, "\\(hy"); + p->flags &= ~TERMP_BOLD; break; case (MDOC_Enum): (pair->ppair->ppair->count)++; @@ -924,8 +933,6 @@ termp_it_pre(DECL_ARGS) default: break; } - - p->flags = sv; /* Restore saved flags. */ /* * If we're not going to process our children, indicate so here.