groff-commit
[Top][All Lists]
Advanced

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

[groff] 46/46: [tbl]: Fix off-by-one error in generated diag msg.


From: G. Branden Robinson
Subject: [groff] 46/46: [tbl]: Fix off-by-one error in generated diag msg.
Date: Wed, 7 Dec 2022 04:32:38 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit 4dc1be32f504da5baa00b0ed61421585631c3fc0
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Wed Dec 7 02:46:41 2022 -0600

    [tbl]: Fix off-by-one error in generated diag msg.
    
    [tbl]: Fix off-by-one error in generated diagnostic message.
    
    * src/preproc/tbl/table.cpp: Define new preprocessor macro,
      `PREVIOUS_PAGE_REG`.
    
      (table::init_output): Compute value for register named using
      `PREVIOUS_PAGE_REG`, use it in diagnostic, and then remove it.  Also
      fix verb tense in message.
---
 ChangeLog                 | 10 ++++++++++
 src/preproc/tbl/table.cpp | 10 +++++++---
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a27fd5a51..12ab3793d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2022-12-07  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [tbl]: Fix off-by-one error in generated diagnostic message.
+
+       * src/preproc/tbl/table.cpp: Define new preprocessor macro,
+       `PREVIOUS_PAGE_REG`.
+       (table::init_output): Compute value for register named using
+       `PREVIOUS_PAGE_REG`, use it in diagnostic, and then remove it.
+       Also fix verb tense in message.
+
 2022-12-07  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        [tbl]: Expose the fact of a table's boxedness via a troff
diff --git a/src/preproc/tbl/table.cpp b/src/preproc/tbl/table.cpp
index 690aeddf8..088228042 100644
--- a/src/preproc/tbl/table.cpp
+++ b/src/preproc/tbl/table.cpp
@@ -69,6 +69,7 @@ const int DEFAULT_COLUMN_SEPARATION = 3;
 #define SAVED_NUMBERING_SUPPRESSION_COUNT PREFIX "linenumbersuppresscnt"
 #define STARTING_PAGE_REG PREFIX "startingpage"
 #define IS_BOXED_REG PREFIX "is-boxed"
+#define PREVIOUS_PAGE_REG PREFIX "previous-page"
 
 // this must be one character
 #define COMPATIBLE_REG PREFIX "c"
@@ -1907,10 +1908,13 @@ void table::init_output()
           ".EN\n"
           ".      " NOP_NAME "\n");
     entry_list->set_location();
-    prints(".      tmc \\n[.F]:\\n[.c]: error:\n"
-          ".      tmc \" boxed table will not fit on page \\n%;\n"
+    prints(".      nr " PREVIOUS_PAGE_REG " (\\n% - 1)\n"
+          ".      tmc \\n[.F]:\\n[.c]: error:\n"
+          ".      tmc \" boxed table does not fit on page"
+          " \\n[" PREVIOUS_PAGE_REG "];\n"
           ".      tm1 \" use .TS H/.TH with a supporting macro package"
-          "\n");
+          "\n"
+          ".      rr " PREVIOUS_PAGE_REG "\n");
     prints(".      ig " NOP_NAME "\n"
           ".EQ\n"
           "delim on\n"



reply via email to

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