groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 07/49: [man,mdoc]: Fix glitch in continuous rendering.


From: G. Branden Robinson
Subject: [groff] 07/49: [man,mdoc]: Fix glitch in continuous rendering.
Date: Sun, 6 Nov 2022 00:37:18 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 6a1f2e30448681d8f511d9eaf35bf65f29e223da
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Wed Nov 2 03:15:03 2022 -0500

    [man,mdoc]: Fix glitch in continuous rendering.
    
    * tmac/an.tmac (an-end):
    * tmac/mdoc/doc-common (doc-end-macro): Ensure that document footer
      appears in continuous rendering mode even when a final pending output
      line in the document is 1v from the page bottom.  Replace `fl` call
      with `br`, which IMO has clearer semantics.  Extend page length by 1v
      before doing so if the current vertical position is within 1v of the
      page bottom.
    
    Thanks to Alex Colomar for the report.
---
 ChangeLog            | 12 ++++++++++++
 tmac/an.tmac         |  9 ++++++++-
 tmac/mdoc/doc-common | 17 ++++++++---------
 3 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3f620e5c0..0333c6c00 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2022-11-02  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * tmac/an.tmac (an-end):
+       * tmac/mdoc/doc-common (doc-end-macro): Ensure that document
+       footer appears in continuous rendering mode even when a final
+       pending output line in the document is 1v from the page bottom.
+       Replace `fl` call with `br`, which IMO has clearer semantics.
+       Extend page length by 1v before doing so if the current vertical
+       position is within 1v of the page bottom.
+
+       Thanks to Alex Colomar for the report.
+
 2022-11-02  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        [man, mdoc]: Regression-test special case of continuous
diff --git a/tmac/an.tmac b/tmac/an.tmac
index 3a38e1582..401ab45a7 100644
--- a/tmac/an.tmac
+++ b/tmac/an.tmac
@@ -111,7 +111,14 @@
 .de1 an-end
 .  if !r an-TH-was-called .return
 .  if \\n[cR] \{\
-.    fl
+.    \" We might have a pending output line that is not yet broken, and
+.    \" also be 1v from the bottom of the page.  If we break (or flush)
+.    \" the output line now, the page will get ejected afterward and
+.    \" troff will exit because we're in an end-of-input macro--our
+.    \" footer will never be output.  So, if that is the case, further
+.    \" extend the page length by 1v.
+.    if ((\\n[.p] - \\n[nl]) <= \\n[.V]) .pl +1v
+.    br
 .    pl +1v
 .    sp 1v
 .    an-footer
diff --git a/tmac/mdoc/doc-common b/tmac/mdoc/doc-common
index 3fe7ded24..d76917166 100644
--- a/tmac/mdoc/doc-common
+++ b/tmac/mdoc/doc-common
@@ -1112,18 +1112,17 @@
 .
 .eo
 .de doc-end-macro
-.  \" We may still have a partial line in the environment.  If this is
-.  \" the case, and we happen to be on the last line of the page, the
-.  \" '.fl' request will cause the page to be ejected and troff will
-.  \" immediately exit.  If we are in nroff mode, this would be
-.  \" unfortunate, since we would never get a chance to output the
-.  \" footer.  So we fudge the page length to make sure that the last
-.  \" page is never ejected until we want it to be.
-.
-.  fl
 .  doc-check-depth
 .
 .  if \n[cR] \{\
+.    \" We might have a pending output line that is not yet broken, and
+.    \" also be 1v from the bottom of the page.  If we break (or flush)
+.    \" the output line now, the page will get ejected afterward and
+.    \" troff will exit because we're in an end-of-input macro--our
+.    \" footer will never be output.  So, if that is the case, further
+.    \" extend the page length by 1v.
+.    if ((\n[.p] - \n[nl]) <= \n[.V]) .pl +1v
+.    br
 .    pl +1v
 .    sp 1v
 .    doc-footer



reply via email to

[Prev in Thread] Current Thread [Next in Thread]