gbranden pushed a commit to branch master
in repository groff.

commit 6a99160c8359aff04880295c6d37586e80298f5a
Author: G. Branden Robinson <[email protected]>
AuthorDate: Mon Jan 29 19:46:48 2024 -0600

    [tbl]: Fix Savannah #65225.
    
    * src/preproc/tbl/table.cpp (table::add_entry): Fix regression in
      repeated glyph tbl(1) feature (`\R`), rendering it inoperative.
      Problem introduced by me in commit 4f4b79b8aa, 26 April 2022.  Restore
      logic to handle this table entry type.  Also throw new error
      diagnostic if the repeated glyph token appears with no argument.  Also
      improve code style by reusing variable with already-computed entry
      string length instead of calculating it again.
    
    Fixes <https://savannah.gnu.org/bugs/?65225>.  Thanks to the anonymous
    submitter for a reproducing case and a correct suggestion of the
    offending commit.
---
 ChangeLog                 | 17 +++++++++++++++++
 src/preproc/tbl/table.cpp | 10 ++++++++++
 2 files changed, 27 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index ca17662f5..b2fa75e5e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2024-01-29  G. Branden Robinson <[email protected]>
+
+       [tbl]: Fix Savannah #65225.
+
+       * src/preproc/tbl/table.cpp (table::add_entry): Fix regression
+       in repeated glyph tbl(1) feature (`\R`), rendering it
+       inoperative.  Problem introduced by me in commit 4f4b79b8aa, 26
+       April 2022.  Restore logic to handle this table entry type.
+       Also throw new error diagnostic if the repeated glyph token
+       appears with no argument.  Also improve code style by reusing
+       variable with already-computed entry string length instead of
+       calculating it again.
+
+       Fixes <https://savannah.gnu.org/bugs/?65225>.  Thanks to the
+       anonymous submitter for a reproducing case and a correct
+       suggestion of the offending commit.
+
 2024-01-29  G. Branden Robinson <[email protected]>
 
        [tbl]: Regression-test Savannah #65225.
diff --git a/src/preproc/tbl/table.cpp b/src/preproc/tbl/table.cpp
index c3e65d429..3459e9276 100644
--- a/src/preproc/tbl/table.cpp
+++ b/src/preproc/tbl/table.cpp
@@ -1581,6 +1581,16 @@ void table::add_entry(int r, int c, const string &str,
     else
       do_vspan(r, c);
   }
+  else if (strncmp(s, "\\R", 2) == 0) {
+    if (len < 3) {
+      error("'\\R' requires a glyph to repeat");
+      e = new empty_entry(this, f);
+    }
+    else {
+      char *glyph = str.substring(2, len - 2).extract();
+      e = new repeated_char_entry(this, f, glyph);
+    }
+  }
   else {
     int is_block = str.search('\n') >= 0;
     switch (f->type) {

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

Reply via email to