groff-commit
[Top][All Lists]
Advanced

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

[groff] 03/03: Fix Savannah #59812.


From: G. Branden Robinson
Subject: [groff] 03/03: Fix Savannah #59812.
Date: Thu, 25 Feb 2021 01:45:58 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit 633de5c27e299ba9421ca8ba298a5bc90e56ff1c
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Thu Feb 25 17:28:43 2021 +1100

    Fix Savannah #59812.
    
    Fix bug where having line numbering off but the output line number
    register \n[ln] set to a positive value would cause tbl(1) table rows to
    spontaneously become numbered.  Use new \n[.nm] register to determine
    whether line numbering is enabled.
    
    * src/preproc/tbl/table.cpp (table::init_output, table::do_row,
      table::do_bottom): Predicate all conditions on \n[ln] additionally on
      \n[.nm].
    
    Thanks to Olle Lögdahl for the report.  Problem appears to date back to
    commit b69062693d3360efce9d4d63fac337be21e07db7, 20 July 2011.
    
    Fixes <https://savannah.gnu.org/bugs/?59812>.
---
 ChangeLog                 | 17 +++++++++++++++++
 src/preproc/tbl/table.cpp | 16 ++++++++--------
 2 files changed, 25 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5731db7..464eaea 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,22 @@
 2021-02-25  G. Branden Robinson <g.branden.robinson@gmail.com>
 
+       Fix bug where having line numbering off but the output line
+       number register \n[ln] set to a positive value would cause
+       tbl(1) table rows to spontaneously become numbered.  Use new
+       \n[.nm] register to determine whether line numbering is enabled.
+
+       * src/preproc/tbl/table.cpp (table::init_output, table::do_row,
+       table::do_bottom): Predicate all conditions on \n[ln]
+       additionally on \n[.nm].
+
+       Thanks to Olle Lögdahl for the report.  Problem appears to date
+       back to commit b69062693d3360efce9d4d63fac337be21e07db7, 20 July
+       2011.
+
+       Fixes <https://savannah.gnu.org/bugs/?59812>.
+
+2021-02-25  G. Branden Robinson <g.branden.robinson@gmail.com>
+
        Add regression test for Savannah #59812.
 
        * src/preproc/tbl/tests/cooperate-with-nm-request.sh: Do it.
diff --git a/src/preproc/tbl/table.cpp b/src/preproc/tbl/table.cpp
index 4eb5841..60b61b9 100644
--- a/src/preproc/tbl/table.cpp
+++ b/src/preproc/tbl/table.cpp
@@ -1818,7 +1818,7 @@ void table::init_output()
         ".ie !'\\n(.z'' \\{.nm\n"
         "\\!." REPEATED_NM_SET_MACRO " \"\\$1\"\n"
         ".\\}\n"
-        ".el .if \\n[ln] \\{\\\n"
+        ".el .if \\n[.nm] .if \\n[ln] \\{\\\n"
         ".if '\\$1'd' .nr " ROW_START_LINE_REG " \\n[ln]\n"
         ".if '\\$1's' .nm \\n[" ROW_START_LINE_REG "]\n"
         ".if '\\$1'm' .nr " ROW_MAX_LINE_REG " \\n[ln]>?\\n[" ROW_MAX_LINE_REG 
"]\n"
@@ -1828,7 +1828,7 @@ void table::init_output()
         ".ie !'\\n(.z'' \\{.nm\n"
         "\\!." REPEATED_NM_SUS_MACRO " \"\\$1\"\n"
         ".\\}\n"
-        ".el .if \\n[ln] \\{\\\n"
+        ".el .if \\n[.nm] .if \\n[ln] \\{\\\n"
         ".ie '\\$1's' \\{\\\n"
         ".nr " ROW_SAVE_LINE_REG " \\n(ln<?\\n[" ROW_MAX_LINE_REG "]\n"
         ".nm +0 \\n[ln]+42\n"
@@ -1878,12 +1878,12 @@ void table::init_output()
           ".  tm1 \" table row will not fit on page \\n%\n"
           ".\\}\n"
           ".nf\n"
-          ".if \\n[ln] .nm \\n[ln]\n"
+          ".if \\n[.nm] .if \\n[ln] .nm \\n[ln]\n"
           ".nr " ROW_MAX_LINE_REG " \\n[ln]\n"
           ".ls 1\n"
           "." SECTION_DIVERSION_NAME "\n"
           ".ls\n"
-          ".if \\n[ln] .nm\n"
+          ".if \\n[.nm] .if \\n[ln] .nm\n"
           ".rm " SECTION_DIVERSION_NAME "\n"
           ".\\}\n"
           "..\n"
@@ -1913,12 +1913,12 @@ void table::init_output()
           ".in 0\n"
           ".ls 1\n"
           ".nf\n"
-          ".if \\n[ln] .nm \\n[ln]\n"
+          ".if \\n[.nm] .if \\n[ln] .nm \\n[ln]\n"
           "." TABLE_DIVERSION_NAME "\n"
           ".\\}\n"
           ".rm " TABLE_DIVERSION_NAME "\n"
           ".\\}\n"
-          ".if \\n[ln] \\{.nm\n"
+          ".if \\n[.nm] .if \\n[ln] \\{.nm\n"
           ".nr ln \\n[" ROW_MAX_LINE_REG "]\n"
           ".\\}\n"
           "..\n");
@@ -2918,7 +2918,7 @@ void table::do_row(int r)
     if (!(flags & NOKEEP) && row_ends_section(r))
       prints(".if \\n[" USE_KEEPS_REG "] ." RELEASE_MACRO_NAME "\n");
   }
-  prints(".if \\n[ln] .nr ln \\n[" ROW_MAX_LINE_REG "]\n");
+  prints(".if \\n[.nm] .if \\n[ln] .nr ln \\n[" ROW_MAX_LINE_REG "]\n");
 }
 
 void table::do_top()
@@ -2978,7 +2978,7 @@ void table::do_bottom()
   if (!(flags & NOKEEP) && (flags & (BOX | DOUBLEBOX | ALLBOX)))
     prints("." TABLE_RELEASE_MACRO_NAME "\n");
   else
-    prints(".if \\n[ln] \\{.nm\n"
+    prints(".if \\n[.nm] .if \\n[ln] \\{.nm\n"
           ".nr ln \\n[" ROW_MAX_LINE_REG "]\n"
           ".\\}\n");
   if (flags & DOUBLEBOX)



reply via email to

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