=================================================================== RCS file: /cvs/mandoc/man_term.c,v retrieving revision 1.139 retrieving revision 1.144 diff -u -p -r1.139 -r1.144 --- mandoc/man_term.c 2013/12/22 23:34:13 1.139 +++ mandoc/man_term.c 2014/03/30 21:28:01 1.144 @@ -1,7 +1,7 @@ -/* $Id: man_term.c,v 1.139 2013/12/22 23:34:13 schwarze Exp $ */ +/* $Id: man_term.c,v 1.144 2014/03/30 21:28:01 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons - * Copyright (c) 2010, 2011, 2012, 2013 Ingo Schwarze + * Copyright (c) 2010-2014 Ingo Schwarze * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -84,6 +84,7 @@ static int pre_ft(DECL_ARGS); static int pre_ign(DECL_ARGS); static int pre_in(DECL_ARGS); static int pre_literal(DECL_ARGS); +static int pre_ll(DECL_ARGS); static int pre_sp(DECL_ARGS); static void post_IP(DECL_ARGS); @@ -133,6 +134,7 @@ static const struct termact termacts[MAN_MAX] = { { pre_literal, NULL, 0 }, /* EE */ { pre_UR, post_UR, 0 }, /* UR */ { NULL, NULL, 0 }, /* UE */ + { pre_ll, NULL, MAN_NOTEXT }, /* ll */ }; @@ -237,6 +239,16 @@ pre_ign(DECL_ARGS) /* ARGSUSED */ static int +pre_ll(DECL_ARGS) +{ + + term_setwidth(p, n->nchild ? n->child->string : NULL); + return(0); +} + + +/* ARGSUSED */ +static int pre_I(DECL_ARGS) { @@ -658,7 +670,8 @@ pre_IP(DECL_ARGS) return(0); case (MAN_BODY): p->offset = mt->offset + len; - p->rmargin = p->maxrmargin; + p->rmargin = p->maxrmargin > p->offset ? + p->maxrmargin : p->offset; break; default: break; @@ -719,7 +732,7 @@ pre_TP(DECL_ARGS) /* Calculate offset. */ if (NULL != (nn = n->parent->head->child)) - if (nn->string && nn->parent->line == nn->line) + if (nn->string && 0 == (MAN_LINE & nn->flags)) if ((ival = a2width(p, nn->string)) >= 0) len = (size_t)ival; @@ -736,10 +749,15 @@ pre_TP(DECL_ARGS) mt->fl &= ~MANT_LITERAL; /* Don't print same-line elements. */ - for (nn = n->child; nn; nn = nn->next) - if (nn->line > n->line) - print_man_node(p, mt, nn, meta); + nn = n->child; + while (NULL != nn && 0 == (MAN_LINE & nn->flags)) + nn = nn->next; + while (NULL != nn) { + print_man_node(p, mt, nn, meta); + nn = nn->next; + } + if (savelit) mt->fl |= MANT_LITERAL; if (ival >= 0) @@ -748,7 +766,8 @@ pre_TP(DECL_ARGS) return(0); case (MAN_BODY): p->offset = mt->offset + len; - p->rmargin = p->maxrmargin; + p->rmargin = p->maxrmargin > p->offset ? + p->maxrmargin : p->offset; p->trailspace = 0; p->flags &= ~TERMP_NOBREAK; break; @@ -909,8 +928,9 @@ pre_RS(DECL_ARGS) sz = (size_t)ival; mt->offset += sz; - p->rmargin = p->maxrmargin; - p->offset = mt->offset < p->rmargin ? mt->offset : p->rmargin; + p->offset = mt->offset; + p->rmargin = p->maxrmargin > p->offset ? + p->maxrmargin : p->offset; if (++mt->lmarginsz < MAXMARGINS) mt->lmargincur = mt->lmarginsz; @@ -1037,7 +1057,7 @@ out: * more specific than this. */ if (MANT_LITERAL & mt->fl && ! (TERMP_NOBREAK & p->flags) && - (NULL == n->next || n->next->line > n->line)) { + (NULL == n->next || MAN_LINE & n->next->flags)) { rm = p->rmargin; rmax = p->maxrmargin; p->rmargin = p->maxrmargin = TERM_MAXMARGIN;