=================================================================== RCS file: /cvs/mandoc/mdoc_term.c,v retrieving revision 1.306 retrieving revision 1.313 diff -u -p -r1.306 -r1.313 --- mandoc/mdoc_term.c 2015/02/01 23:10:35 1.306 +++ mandoc/mdoc_term.c 2015/03/06 15:48:52 1.313 @@ -1,4 +1,4 @@ -/* $Id: mdoc_term.c,v 1.306 2015/02/01 23:10:35 schwarze Exp $ */ +/* $Id: mdoc_term.c,v 1.313 2015/03/06 15:48:52 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2010, 2012-2015 Ingo Schwarze @@ -309,6 +309,7 @@ print_mdoc_node(DECL_ARGS) chld = 1; offset = p->offset; rmargin = p->rmargin; + n->flags &= ~MDOC_ENDED; n->prev_font = p->fonti; memset(&npair, 0, sizeof(struct termpair)); @@ -319,12 +320,9 @@ print_mdoc_node(DECL_ARGS) * invoked in a prior line, revert it to PREKEEP. */ - if (TERMP_KEEP & p->flags) { - if (n->prev ? (n->prev->lastline != n->line) : - (n->parent && n->parent->line != n->line)) { - p->flags &= ~TERMP_KEEP; - p->flags |= TERMP_PREKEEP; - } + if (p->flags & TERMP_KEEP && n->flags & MDOC_LINE) { + p->flags &= ~TERMP_KEEP; + p->flags |= TERMP_PREKEEP; } /* @@ -350,6 +348,8 @@ print_mdoc_node(DECL_ARGS) p->flags |= TERMP_NOSPACE; break; case MDOC_TBL: + if (p->tbl.cols == NULL) + term_newln(p); term_tbl(p, n->span); break; default: @@ -364,7 +364,7 @@ print_mdoc_node(DECL_ARGS) print_mdoc_nodelist(p, &npair, meta, n->child); term_fontpopq(p, - (ENDBODY_NOT == n->end ? n : n->pending)->prev_font); + (ENDBODY_NOT == n->end ? n : n->body)->prev_font); switch (n->type) { case MDOC_TEXT: @@ -384,7 +384,7 @@ print_mdoc_node(DECL_ARGS) * that it must not call the post handler again. */ if (ENDBODY_NOT != n->end) - n->pending->flags |= MDOC_ENDED; + n->body->flags |= MDOC_ENDED; /* * End of line terminating an implicit block @@ -1094,9 +1094,6 @@ termp_an_pre(DECL_ARGS) return(0); } - if (n->child == NULL) - return(0); - if (p->flags & TERMP_SPLIT) term_newln(p); @@ -1813,7 +1810,7 @@ static int termp_sp_pre(DECL_ARGS) { struct roffsu su; - size_t i, len; + int i, len; switch (n->tok) { case MDOC_sp: @@ -1834,8 +1831,11 @@ termp_sp_pre(DECL_ARGS) if (0 == len) term_newln(p); - for (i = 0; i < len; i++) - term_vspace(p); + else if (len < 0) + p->skipvsp -= len; + else + for (i = 0; i < len; i++) + term_vspace(p); return(0); } @@ -1878,7 +1878,7 @@ termp_quote_pre(DECL_ARGS) case MDOC_Do: /* FALLTHROUGH */ case MDOC_Dq: - term_word(p, "\\(lq"); + term_word(p, "\\(Lq"); break; case MDOC_En: if (NULL == n->norm->Es || @@ -1947,7 +1947,7 @@ termp_quote_post(DECL_ARGS) case MDOC_Do: /* FALLTHROUGH */ case MDOC_Dq: - term_word(p, "\\(rq"); + term_word(p, "\\(Rq"); break; case MDOC_En: if (n->norm->Es == NULL || @@ -1995,9 +1995,8 @@ termp_eo_pre(DECL_ARGS) n->child->end != ENDBODY_NOT) term_word(p, "\\&"); else if (n->end != ENDBODY_NOT ? n->child != NULL : - n->parent->head->child != NULL && - (n->parent->body->child != NULL || - n->parent->tail->child != NULL)) + n->parent->head->child != NULL && (n->child != NULL || + (n->parent->tail != NULL && n->parent->tail->child != NULL))) p->flags |= TERMP_NOSPACE; return(1);