Print this page
9718 update mandoc to 1.14.4

@@ -1,9 +1,9 @@
-/*      $Id: man_term.c,v 1.209 2017/07/31 15:19:06 schwarze Exp $ */
+/*      $Id: man_term.c,v 1.211 2018/06/10 15:12:35 schwarze Exp $ */
 /*
  * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2010-2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2010-2015, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
  * copyright notice and this permission notice appear in all copies.
  *

@@ -673,11 +673,12 @@
 
                 do {
                         n = n->prev;
                 } while (n != NULL && n->tok >= MAN_TH &&
                     termacts[n->tok].flags & MAN_NOTEXT);
-                if (n == NULL || (n->tok == MAN_SS && n->body->child == NULL))
+                if (n == NULL || n->type == ROFFT_COMMENT ||
+                    (n->tok == MAN_SS && n->body->child == NULL))
                         break;
 
                 for (i = 0; i < mt->pardist; i++)
                         term_vspace(p);
                 break;

@@ -735,11 +736,12 @@
 
                 do {
                         n = n->prev;
                 } while (n != NULL && n->tok >= MAN_TH &&
                     termacts[n->tok].flags & MAN_NOTEXT);
-                if (n == NULL || (n->tok == MAN_SH && n->body->child == NULL))
+                if (n == NULL || n->type == ROFFT_COMMENT ||
+                    (n->tok == MAN_SH && n->body->child == NULL))
                         break;
 
                 for (i = 0; i < mt->pardist; i++)
                         term_vspace(p);
                 break;

@@ -883,11 +885,12 @@
                     (p->flags & TERMP_NONEWLINE) == 0)
                         term_newln(p);
 
                 term_word(p, n->string);
                 goto out;
-
+        case ROFFT_COMMENT:
+                return;
         case ROFFT_EQN:
                 if ( ! (n->flags & NODE_LINE))
                         p->flags |= TERMP_NOSPACE;
                 term_eqn(p, n->eqn);
                 if (n->next != NULL && ! (n->next->flags & NODE_LINE))

@@ -1027,10 +1030,22 @@
         p->tcol->offset = p->tcol->rmargin;
         p->tcol->rmargin = p->maxrmargin;
 
         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);
 }
 
 static void
 print_man_head(struct termp *p, const struct roff_meta *meta)