commit 1d939ccdf93a20e1bb9fb67b7aec52143706977b Author: G. Branden Robinson Date: 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. * tmac/mdoc/doc-common (doc-end-macro): We now need to perform a dynamic calculation using registers, so unwrap macro definition with `eo`/`ec` requests, and double backslashes in escape sequences that are interpreted in copy mode. Thanks to Alex Colomar for the report. diff --git a/ChangeLog b/ChangeLog index 3f620e5c0..171a3c1fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2022-11-02 G. Branden Robinson + + * 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. + + * tmac/mdoc/doc-common (doc-end-macro): We now need to perform a + dynamic calculation using registers, so unwrap macro definition + with `eo`/`ec` requests, and double backslashes in escape + sequences that are interpreted in copy mode. + + Thanks to Alex Colomar for the report. + 2022-11-02 G. Branden Robinson [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..b087d6308 100644 --- a/tmac/mdoc/doc-common +++ b/tmac/mdoc/doc-common @@ -1110,34 +1110,32 @@ .\" NS modifies: .\" NS doc-is-first-page-of-document . -.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] \{\ +. 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 . \" If we're processing multiple documents and have started a new . \" one, draw a line between this footer and the next header. -. if !'\n[.F]'' \{\ +. if !'\\n[.F]'' \{\ . pl +1v . nf . ti 0 -\D'l \n[doc-line-length]u 0' +\D'l \\n[doc-line-length]u 0' . fi . \} . \" suppress empty lines after the footer -. pl \n[nl]u +. pl \\n[nl]u . \} . ch doc-header . bp @@ -1151,7 +1149,6 @@ . ds doc-operating-system \" empty . ds doc-topic-name \" empty .. -.ec . . .\" NS doc-paragraph macro