=================================================================== RCS file: /cvs/mandoc/mdoc_term.c,v retrieving revision 1.256 retrieving revision 1.260 diff -u -p -r1.256 -r1.260 --- mandoc/mdoc_term.c 2013/12/25 14:40:34 1.256 +++ mandoc/mdoc_term.c 2014/03/30 19:47:48 1.260 @@ -1,7 +1,7 @@ -/* $Id: mdoc_term.c,v 1.256 2013/12/25 14:40:34 schwarze Exp $ */ +/* $Id: mdoc_term.c,v 1.260 2014/03/30 19:47:48 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons - * Copyright (c) 2010, 2012, 2013 Ingo Schwarze + * Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze * Copyright (c) 2013 Franco Fichtner * * Permission to use, copy, modify, and distribute this software for any @@ -104,6 +104,7 @@ static int termp_ft_pre(DECL_ARGS); static int termp_in_pre(DECL_ARGS); static int termp_it_pre(DECL_ARGS); static int termp_li_pre(DECL_ARGS); +static int termp_ll_pre(DECL_ARGS); static int termp_lk_pre(DECL_ARGS); static int termp_nd_pre(DECL_ARGS); static int termp_nm_pre(DECL_ARGS); @@ -244,6 +245,7 @@ static const struct termact termacts[MDOC_MAX] = { { termp_sp_pre, NULL }, /* sp */ { NULL, termp____post }, /* %U */ { NULL, NULL }, /* Ta */ + { termp_ll_pre, NULL }, /* ll */ }; @@ -384,8 +386,10 @@ print_mdoc_node(DECL_ARGS) if (MDOC_EOS & n->flags) p->flags |= TERMP_SENTENCE; - p->offset = offset; - p->rmargin = rmargin; + if (MDOC_ll != n->tok) { + p->offset = offset; + p->rmargin = rmargin; + } } @@ -615,6 +619,16 @@ print_bvspace(struct termp *p, /* ARGSUSED */ static int +termp_ll_pre(DECL_ARGS) +{ + + (*p->setwidth)(p, n->nchild ? a2width(p, n->child->string) : 0); + return(0); +} + + +/* ARGSUSED */ +static int termp_it_pre(DECL_ARGS) { const struct mdoc_node *bl, *nn; @@ -873,8 +887,11 @@ termp_it_pre(DECL_ARGS) assert(width); if (MDOC_HEAD == n->type) p->rmargin = p->offset + width; - else + else { p->offset += width; + if (p->rmargin < p->offset) + p->rmargin = p->offset; + } break; case (LIST_column): assert(width); @@ -1529,7 +1546,7 @@ termp_ft_pre(DECL_ARGS) static int termp_fn_pre(DECL_ARGS) { - size_t width, rmargin = 0; + size_t rmargin = 0; int pretty; pretty = MDOC_SYNPRETTY & n->flags; @@ -1540,9 +1557,8 @@ termp_fn_pre(DECL_ARGS) return(0); if (pretty) { - width = term_len(p, 4); rmargin = p->rmargin; - p->rmargin = p->offset + width; + p->rmargin = p->offset + term_len(p, 4); p->flags |= TERMP_NOBREAK | TERMP_HANG; } @@ -1602,8 +1618,7 @@ termp_fa_pre(DECL_ARGS) for (nn = n->child; nn; nn = nn->next) { term_fontpush(p, TERMFONT_UNDER); - if (MDOC_SYNPRETTY & n->flags) - p->flags |= TERMP_NBRWORD; + p->flags |= TERMP_NBRWORD; term_word(p, nn->string); term_fontpop(p); @@ -2034,7 +2049,7 @@ termp_quote_post(DECL_ARGS) static int termp_fo_pre(DECL_ARGS) { - size_t width, rmargin = 0; + size_t rmargin = 0; int pretty; pretty = MDOC_SYNPRETTY & n->flags; @@ -2044,9 +2059,8 @@ termp_fo_pre(DECL_ARGS) return(1); } else if (MDOC_BODY == n->type) { if (pretty) { - width = term_len(p, 4); rmargin = p->rmargin; - p->rmargin = p->offset + width; + p->rmargin = p->offset + term_len(p, 4); p->flags |= TERMP_NOBREAK | TERMP_HANG; } p->flags |= TERMP_NOSPACE;