gbranden pushed a commit to branch master
in repository groff.

commit ae66055171b7380114a35bad7c58e78e6713d6e6
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sun Aug 3 03:34:04 2025 -0500

    [mm]: Fix bugs in `LB` macro.
    
    * contrib/mm/m.tmac (LB): (1) Fix copy-and-paste error that prevented
      "I" from being recognized as a valid register format; next (2) in a
      *roff numeric expression, `&` doesn't have short-circuit semantics
      like C's `&&` or Ada's `and then`, so use nested `if` requests to
      prevent interpolation of a non-number as an operand to a comparison;
      and finally (3) actually assign the valid format to the appropriate
      register for the (nested) list.
    
    Fixes <https://savannah.gnu.org/bugs/?67388>.  Problems introduced by me
    in commit c243961bce, 9 October.
---
 contrib/mm/ChangeLog | 14 ++++++++++++++
 contrib/mm/m.tmac    |  6 ++++--
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/contrib/mm/ChangeLog b/contrib/mm/ChangeLog
index c2a211364..5642c767b 100644
--- a/contrib/mm/ChangeLog
+++ b/contrib/mm/ChangeLog
@@ -1,3 +1,17 @@
+2025-08-03  G. Branden Robinson <[email protected]>
+
+       * m.tmac (LB): Fix bugs.  (1) Fix copy-and-paste error that
+       prevented "I" from being recognized as a valid register format;
+       next (2) in a *roff numeric expression, `&` doesn't have
+       short-circuit semantics like C's `&&` or Ada's `and then`, so
+       use nested `if` requests to prevent interpolation of a
+       non-number as an operand to a comparison; and finally (3)
+       actually assign the valid format to the appropriate register for
+       the (nested) list.
+
+       Fixes <https://savannah.gnu.org/bugs/?67388>.  Problems
+       introduced by me in commit c243961bce, 9 October.
+
 2025-08-03  G. Branden Robinson <[email protected]>
 
        * tests/LB-mark-format-works.sh: Unit-test handling of `LB`
diff --git a/contrib/mm/m.tmac b/contrib/mm/m.tmac
index 632487da8..fc8d78b47 100644
--- a/contrib/mm/m.tmac
+++ b/contrib/mm/m.tmac
@@ -2493,17 +2493,19 @@ h=\\n[df*height!\\n[df*o-fnr]]
 .      ie '\?\\*[li*mf]\?'\?\&\?' .af li*cnt!\\n[li*lvl] 0
 .      el \{\
 .              nr li*is-format-valid 0
-.              if \B'\\*[li*mf]'&\\*[li*mf]>-1 .nr li*is-format-valid 1
 .              if '\?\\*[li*mf]\?'\?a\?'       .nr li*is-format-valid 1
 .              if '\?\\*[li*mf]\?'\?A\?'       .nr li*is-format-valid 1
 .              if '\?\\*[li*mf]\?'\?i\?'       .nr li*is-format-valid 1
-.              if '\?\\*[li*mf]\?'\?i\?'       .nr li*is-format-valid 1
+.              if '\?\\*[li*mf]\?'\?I\?'       .nr li*is-format-valid 1
+.              if \B'\\*[li*mf]' \
+.                      if \\*[li*mf]>-1        .nr li*is-format-valid 1
 .              if !\\n[li*is-format-valid] \{\
 .                      @warning \\$0: type argument is \\n[li*type] \
 but mark argument '\\*[li*mf]' is not a valid register format; \
 assuming '0'
 .                      ds li*mf 0\"
 .              \}
+.              af li*cnt!\\n[li*lvl] \\*[li*mf]
 .      \}
 .\}
 .\"

_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to