groff-commit
[Top][All Lists]
Advanced

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

[groff] 03/06: [tbl]: Fix Savannah #66290 (zombie `nm` revives).


From: G. Branden Robinson
Subject: [groff] 03/06: [tbl]: Fix Savannah #66290 (zombie `nm` revives).
Date: Fri, 4 Oct 2024 06:49:35 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 14906bc3cfde775dd32ff49ed0cd461046c5a9c3
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Fri Oct 4 05:01:26 2024 -0500

    [tbl]: Fix Savannah #66290 (zombie `nm` revives).
    
    * src/preproc/tbl/table.cpp: Add C preprocessor macro storing the name
      of a groff register for saving the state of line numering enablement.
    
      (table::init_output): Save the value of the `.nm` register to this
      groff register.
    
      (table::do_bottom): Test the value of that register (instead of the
      saved line number itself) when deciding whether to reënable line
      numbering after leaving the table region.
    
    Fixes <https://savannah.gnu.org/bugs/?66290>.  Problem introduced by me
    in commit 950f92e25f, 28 November 2022, when fixing Savannah #61040.
    Thanks to Deri James for the report.
    
    See also <https://savannah.gnu.org/bugs/?59812>.
---
 ChangeLog                 | 15 +++++++++++++++
 src/preproc/tbl/table.cpp |  4 +++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 08d84d5bb..eb4d70e5c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2024-10-04  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * src/preproc/tbl/table.cpp: Add C preprocessor macro storing
+       the name of a groff register for saving the state of line
+       numering enablement.
+       (table::init_output): Save the value of the `.nm` register to
+       this groff register.
+       (table::do_bottom): Test the value of that register (instead of
+       the saved line number itself) when deciding whether to reënable
+       line numbering after leaving the table region.
+
+       Fixes <https://savannah.gnu.org/bugs/?66290>.  Problem
+       introduced by me in commit 950f92e25f, 28 November 2022, when
+       fixing Savannah #61040.  Thanks to Deri James for the report.
+
 2024-10-04  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * src/preproc/tbl/tests/save-and-restore-line-numbering.sh: Add
diff --git a/src/preproc/tbl/table.cpp b/src/preproc/tbl/table.cpp
index 596a854b0..a3cbf4b4a 100644
--- a/src/preproc/tbl/table.cpp
+++ b/src/preproc/tbl/table.cpp
@@ -68,6 +68,7 @@ const int DEFAULT_COLUMN_SEPARATION = 3;
 #define SAVED_HYPHENATION_MARGIN_REG PREFIX "hyphmargin"
 #define SAVED_HYPHENATION_SPACE_REG PREFIX "hyphspace"
 #define SAVED_NUMBERING_LINENO PREFIX "linenumber"
+#define SAVED_NUMBERING_ENABLED PREFIX "linenumberingenabled"
 #define SAVED_NUMBERING_SUPPRESSION_COUNT PREFIX "linenumbersuppresscnt"
 #define STARTING_PAGE_REG PREFIX "starting-page"
 #define IS_BOXED_REG PREFIX "is-boxed"
@@ -2018,6 +2019,7 @@ void table::init_output()
         ".ce 0\n");
   prints(".nr " SAVED_NUMBERING_LINENO " \\n[ln]\n"
         ".nr ln 0\n"
+        ".nr " SAVED_NUMBERING_ENABLED " \\n[.nm]\n"
         ".nr " SAVED_NUMBERING_SUPPRESSION_COUNT " \\n[.nn]\n"
         ".nn 2147483647\n"); // 2^31-1; inelegant but effective
   prints(".nf\n");
@@ -3157,7 +3159,7 @@ void table::do_bottom()
     prints(".if n .sp\n");
   prints("." RESET_MACRO_NAME "\n"
         ".nn \\n[" SAVED_NUMBERING_SUPPRESSION_COUNT "]\n"
-        ".ie \\n[" SAVED_NUMBERING_LINENO "] "
+        ".ie \\n[" SAVED_NUMBERING_ENABLED "] "
         ".nm \\n[" SAVED_NUMBERING_LINENO "]\n"
         ".el .nm\n"
         ".fc\n"



reply via email to

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