gbranden pushed a commit to branch master
in repository groff.

commit ded58835f82c659ba452d1bde638eaf5e7027247
Author: G. Branden Robinson <g.branden.robin...@gmail.com>
AuthorDate: Tue Feb 25 00:10:46 2025 -0600

    [mm]: Fix Savannah #66439 (BS/BE with LT).
    
    * contrib/mm/m.tmac (BS, BE): Use box diversion instead of a regular one
      to populate the bottom block.  This fixes interaction of the bottom
      block feature--when `BS` and `BE` are called prior to formatting any
      other text--with `LT` letters specifically but might also resolve
      other similar problems with BS/BE use.  Using a regular diversion
      moved the vertical drawing position from its "pre-page" location of
      "-1" (because the `BS` macro called `br` to ensure that the bottom
      block didn't absorb any partially collected line).  That in turn
      sprung the default header trap that writes a centered page number.
      The `LT` macro is written such that if the drawing position is not at
      the top of the page, it fails to format the pre-body letter material
      (writer's address, date, inside address, salutation, etc.).  (Because
      the first page has already started and the drawing position was
      non-negative, the `LT` macro was also too late to turn off the default
      header on the first page.)
    
      (BE): Annotate explicit `br` retained here; we don't want to
      silently discard a partially collected line when closing the box
      diversion.  The document author should delete from a bottom
      block any undesired content on a partially collected line.
    
    Fixes <https://savannah.gnu.org/bugs/?66439>.  Thanks to Oliver Corff
    for prompting detection of this bug.
---
 contrib/mm/ChangeLog | 26 ++++++++++++++++++++++++++
 contrib/mm/m.tmac    |  7 +++----
 2 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/contrib/mm/ChangeLog b/contrib/mm/ChangeLog
index 482bce032..cd7c7e205 100644
--- a/contrib/mm/ChangeLog
+++ b/contrib/mm/ChangeLog
@@ -1,3 +1,29 @@
+2025-02-24  G. Branden Robinson <g.branden.robin...@gmail.com>
+
+       * m.tmac (BS, BE): Use box diversion instead of a regular one to
+       populate the bottom block.  This fixes interaction of the bottom
+       block feature--when `BS` and `BE` are called prior to formatting
+       any other text--with `LT` letters specifically but might also
+       resolve other similar problems with BS/BE use.  Using a regular
+       diversion moved the vertical drawing position from its
+       "pre-page" location of "-1" (because the `BS` macro called `br`
+       to ensure that the bottom block didn't absorb any partially
+       collected line).  That in turn sprung the default header trap
+       that writes a centered page number.  The `LT` macro is written
+       such that if the drawing position is not at the top of the page,
+       it fails to format the pre-body letter material (writer's
+       address, date, inside address, salutation, etc.).  (Because the
+       first page has already started and the drawing position was
+       non-negative, the `LT` macro was also too late to turn off the
+       default header on the first page.)
+       (BE): Annotate explicit `br` retained here; we don't want to
+       silently discard a partially collected line when closing the box
+       diversion.  The document author should delete from a bottom
+       block any undesired content on a partially collected line.
+
+       Fixes <https://savannah.gnu.org/bugs/?66439>.  Thanks to Oliver
+       Corff for prompting detection of this bug.
+
 2025-02-24  G. Branden Robinson <g.branden.robin...@gmail.com>
 
        Regression-test Savannah #66439 (the bottom block feature BS/BE
diff --git a/contrib/mm/m.tmac b/contrib/mm/m.tmac
index b74bc7ce3..6b540271f 100644
--- a/contrib/mm/m.tmac
+++ b/contrib/mm/m.tmac
@@ -1707,13 +1707,12 @@ numeric; got '\\$1'
 .de BS
 .misc@ev-keep pg*block-ev
 .@reset
-.br
-.debug@di pg*block-div
+.debug@box pg*block-div
 ..
 .\"-------------------------
 .de BE
-.br
-.debug@di
+.br \" in case the user forgot
+.debug@box
 .nr pg*block-size \\n[dn]u
 .ev
 .pg@move-trap

_______________________________________________
groff-commit mailing list
groff-commit@gnu.org
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to