groff-commit
[Top][All Lists]
Advanced

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

[groff] 26/50: [mm]: Fix bug computing `ML` text indentation.


From: G. Branden Robinson
Subject: [groff] 26/50: [mm]: Fix bug computing `ML` text indentation.
Date: Thu, 4 Jul 2024 21:49:17 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 512b749f4ef2f3be8b76114bcc3223f48c3f50c4
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Tue Jul 2 13:46:24 2024 -0500

    [mm]: Fix bug computing `ML` text indentation.
    
    * contrib/mm/m.tmac (ML): Fix bug in text indentation computation; it
      was 1n too short when no explicit indentation (a second argument) was
      given.  Yet another problem introduced by me in commit e0332c122e, 14
      June.  (Oddly, DWB 3.3 mm misbehaves the same way in nroff mode.)
    
    Exhibit:
    
    .SA 0
    .P
    This is an
    .I mm
    document.
    Sed ut perspiciatis, unde omnis xxx iste natus error sit voluptatem
    accusantium doloremque.
    .P 1
    This is an indented paragraph.
    .ML !
    .LI
    but buy bye cab cad cam can cap car cat caw chi cob cod cog con coo cop
    .LE
    .ML $ \n(Pi
    .LI
    cot cow cox coy cry cub cud cue cup cur cut dab dad dam day deb den dew
    .LE
    .P 1
    This is another indented paragraph.
    
    DWB 3.3 nroff:
    $ DWBHOME=. ./bin/nroff -mm ./ML.mm |cat -s
    
                                      - 1 -
    
           This is an mm document.  Sed ut perspiciatis, unde omnis xxx
           iste natus error sit voluptatem accusantium doloremque.
    
                This is an indented paragraph.
    
           ! but buy bye cab cad cam can cap car cat caw chi cob cod
            cog con coo cop
    
              $ cot cow cox coy cry cub cud cue cup cur cut dab dad dam
                day deb den dew
    
                This is another indented paragraph.
---
 contrib/mm/ChangeLog |  8 ++++++++
 contrib/mm/m.tmac    | 13 +++++++------
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/contrib/mm/ChangeLog b/contrib/mm/ChangeLog
index 176d9da3d..441abc8c1 100644
--- a/contrib/mm/ChangeLog
+++ b/contrib/mm/ChangeLog
@@ -1,3 +1,11 @@
+2024-07-02  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * m.tmac (ML): Fix bug in text indentation computation; it was
+       1n too short when no explicit indentation (a second argument)
+       was given.  Yet another problem introduced by me in commit
+       e0332c122e, 14 June.  (Oddly, DWB 3.3 mm misbehaves the same way
+       in nroff mode.)
+
 2024-07-02  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * m.tmac: Revise debugging output.
diff --git a/contrib/mm/m.tmac b/contrib/mm/m.tmac
index 3bb8daa3e..f6f2c487f 100644
--- a/contrib/mm/m.tmac
+++ b/contrib/mm/m.tmac
@@ -2456,12 +2456,13 @@ exceeds depth of nested lists (\\n[li*lvl])
 .if \\n[.$]>3 .@warning \\$0: ignoring excess arguments
 .if \\n[.$]<1 .@error \\$0: expected 1 to 3 arguments, got \\n[.$]
 .if \\n[D]>2 .tm ML \\$@
-.nr li*ml-width \w@\\$1@u+1n
-.if \\n[.$]<2 .LB      \\n[li*ml-width]u 0 1 0 "\\$1"
-.if \\n[.$]=2 .LB      0\\$2             0 1 0 "\\$1"
-.if \\n[.$]=3 \{\
-.      ie '\\$2'' .LB \\n[li*ml-width]u 0 1 0 "\\$1" 0 1
-.      el         .LB \\n[Li]           0 1 0 "\\$1" 0 1
+.nr li*text-indent \w@\\$1@u+1n
+.ie \\n[.$]<2 .LB        \\n[li*text-indent]u 0 0 0 "\\$1"
+.el \{\
+.      if !\B'\\$2' .@error \\$0: second argument not numeric: '\\$2'
+.      ie \\n[.$]=2 .LB \\$2                 0 0 0 "\\$1"
+.      el           .LB \\n[li*text-indent]u 0 0 0 "\\$1"
+.      \}
 .\}
 ..
 .de VL



reply via email to

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