groff-commit
[Top][All Lists]
Advanced

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

[groff] 29/32: [tbl]: Fix Savannah #61909.


From: G. Branden Robinson
Subject: [groff] 29/32: [tbl]: Fix Savannah #61909.
Date: Wed, 30 Nov 2022 07:26:15 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit d75543ee567db15b2ac93309a4763401933b8f2c
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Tue Nov 29 10:05:21 2022 -0600

    [tbl]: Fix Savannah #61909.
    
    * src/preproc/tbl/table.cpp (SAVED_INTER_WORD_SPACE_SIZE)
      (SAVED_INTER_SENTENCE_SPACE_SIZE): Add new preprocessor macros.
    
    * src/preproc/tbl/table.cpp (SAVED_INTER_WORD_SPACE_SIZE)
      (SAVED_INTER_SENTENCE_SPACE_SIZE): Add new preprocessor macros.
    
      (block_entry::do_divert): Restore saved inter-word and inter-sentence
      space when formatting a text entry.
    
      (table::init_output): When a table region begions, save the values of
      inter-word and inter-sentence space.  Add request to the reset macro
      to restore saved inter-word and inter-sentence space when leaving
      table region.
    
      (table::do_top): Set inter-sentence space to be equal to inter-word
      space.  This way spaces are "literal" in ordinary table extries (but
      not text blocks).
    
    Fixes <https://savannah.gnu.org/bugs/?61909>.
---
 ChangeLog                 | 18 ++++++++++++++++++
 src/preproc/tbl/table.cpp |  9 +++++++++
 2 files changed, 27 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index d7fbf8976..996a2fd36 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2022-11-29  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [tbl]: Fix Savannah #61909.
+
+       * src/preproc/tbl/table.cpp (SAVED_INTER_WORD_SPACE_SIZE)
+       (SAVED_INTER_SENTENCE_SPACE_SIZE): Add new preprocessor macros.
+       (block_entry::do_divert): Restore saved inter-word and
+       inter-sentence space when formatting a text entry.
+       (table::init_output): When a table region begions, save the
+       values of inter-word and inter-sentence space.  Add request to
+       the reset macro to restore saved inter-word and inter-sentence
+       space when leaving table region.
+       (table::do_top): Set inter-sentence space to be equal to
+       inter-word space.  This way spaces are "literal" in ordinary
+       table extries (but not text blocks).
+
+       Fixes <https://savannah.gnu.org/bugs/?61909>.
+
 2022-11-29  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        [tbl]: Regression-test Savannah #61909.
diff --git a/src/preproc/tbl/table.cpp b/src/preproc/tbl/table.cpp
index fbc7e994f..4539d635d 100644
--- a/src/preproc/tbl/table.cpp
+++ b/src/preproc/tbl/table.cpp
@@ -49,6 +49,8 @@ const int DEFAULT_COLUMN_SEPARATION = 3;
 #define SAVED_INDENT_REG PREFIX "ind"
 #define SAVED_CENTER_REG PREFIX "cent"
 #define SAVED_TABS_NAME PREFIX "tabs"
+#define SAVED_INTER_WORD_SPACE_SIZE PREFIX "ss"
+#define SAVED_INTER_SENTENCE_SPACE_SIZE PREFIX "sss"
 #define TABLE_DIVERSION_NAME PREFIX "table"
 #define TABLE_DIVERSION_FLAG_REG PREFIX "tflag"
 #define TABLE_KEEP_MACRO_NAME PREFIX "tkeep"
@@ -726,6 +728,8 @@ void block_entry::do_divert(int alphabetic, int ncols, 
const string *mw,
   if (alphabetic)
     prints("-2n");
   prints("\n");
+  prints(".ss \\n[" SAVED_INTER_WORD_SPACE_SIZE "]"
+      " \\n[" SAVED_INTER_SENTENCE_SPACE_SIZE "]\n");
   prints(".cp \\n(" COMPATIBLE_REG "\n");
   set_modifier(mod);
   set_location();
@@ -1791,12 +1795,16 @@ void table::init_output()
         ".el .nf\n"
         ".ce \\n[.ce]\n"
         ".ta \\\\*[" SAVED_TABS_NAME "]\n"
+        ".ss \\\\n[" SAVED_INTER_WORD_SPACE_SIZE "]"
+        " \\\\n[" SAVED_INTER_SENTENCE_SPACE_SIZE "]\n"
         "..\n"
         ".nr " SAVED_INDENT_REG " \\n[.i]\n"
         ".nr " SAVED_FONT_REG " \\n[.f]\n"
         ".nr " SAVED_SIZE_REG " \\n[.s]\n"
         ".nr " SAVED_FILL_REG " \\n[.u]\n"
         ".ds " SAVED_TABS_NAME " \\n[.tabs]\n"
+        ".nr " SAVED_INTER_WORD_SPACE_SIZE " \\n[.ss]\n"
+        ".nr " SAVED_INTER_SENTENCE_SPACE_SIZE " \\n[.sss]\n"
         ".nr " SAVED_HYPHENATION_MODE_REG " \\n[.hy]\n"
         ".ds " SAVED_HYPHENATION_LANG_NAME " \\n[.hla]\n"
         ".nr " SAVED_HYPHENATION_MAX_LINES_REG " (\\n[.hlm])\n"
@@ -2923,6 +2931,7 @@ void table::do_row(int r)
 
 void table::do_top()
 {
+  prints(".ss \\n[" SAVED_INTER_WORD_SPACE_SIZE "]\n");
   prints(".fc \002\003\n");
   if (!(flags & NOKEEP) && (flags & (BOX | DOUBLEBOX | ALLBOX)))
     prints("." TABLE_KEEP_MACRO_NAME "\n");



reply via email to

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