=================================================================== RCS file: /cvs/mandoc/man_term.c,v retrieving revision 1.210 retrieving revision 1.213 diff -u -p -r1.210 -r1.213 --- mandoc/man_term.c 2018/04/11 17:11:13 1.210 +++ mandoc/man_term.c 2018/08/16 23:43:37 1.213 @@ -1,4 +1,4 @@ -/* $Id: man_term.c,v 1.210 2018/04/11 17:11:13 schwarze Exp $ */ +/* $Id: man_term.c,v 1.213 2018/08/16 23:43:37 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010-2015, 2017, 2018 Ingo Schwarze @@ -98,6 +98,7 @@ static const struct termact __termacts[MAN_MAX - MAN_T { pre_SH, post_SH, 0 }, /* SH */ { pre_SS, post_SS, 0 }, /* SS */ { pre_TP, post_TP, 0 }, /* TP */ + { pre_TP, post_TP, 0 }, /* TQ */ { pre_PP, NULL, 0 }, /* LP */ { pre_PP, NULL, 0 }, /* PP */ { pre_PP, NULL, 0 }, /* P */ @@ -584,7 +585,8 @@ pre_TP(DECL_ARGS) p->flags |= TERMP_NOSPACE; break; case ROFFT_BLOCK: - print_bvspace(p, n, mt->pardist); + if (n->tok == MAN_TP) + print_bvspace(p, n, mt->pardist); /* FALLTHROUGH */ default: return 1; @@ -884,6 +886,8 @@ print_man_node(DECL_ARGS) } else if (*n->string == ' ' && n->flags & NODE_LINE && (p->flags & TERMP_NONEWLINE) == 0) term_newln(p); + else if (n->flags & NODE_DELIMC) + p->flags |= TERMP_NOSPACE; term_word(p, n->string); goto out; @@ -1032,6 +1036,18 @@ print_man_foot(struct termp *p, const struct roff_meta term_word(p, title); term_flushln(p); + + /* + * Reset the terminal state for more output after the footer: + * Some output modes, in particular PostScript and PDF, print + * the header and the footer into a buffer such that it can be + * reused for multiple output pages, then go on to format the + * main text. + */ + + p->tcol->offset = 0; + p->flags = 0; + free(title); }