gbranden pushed a commit to branch master
in repository groff.

commit 51394a4fb18bbf52a4c18655043129c25627c799
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sun Oct 26 21:29:58 2025 -0500

    [grotty]: Fix Savannah #67633 (`-h` tab behavior).
    
    * src/devices/grotty/tty.cpp (tty_printer::end_page): When using hard
      tabs (per the `-h` option), use a space instead of a tab to advance
      the output position when the distance to the next tab stop is only one
      character cell.  This behavior more closely resembles that of AT&T
      nroff.
    
    * src/devices/grotty/TODO: Delete.  Its only item is resolved.
    
    * src/devices/grotty/grotty.am (EXTRA_DIST): Drop "TODO".
    
    Fixes <https://savannah.gnu.org/bugs/?67633>.  Problem originally
    recorded by James Clark in groff 1.06, September 1992.
---
 ChangeLog                    | 14 ++++++++++++++
 src/devices/grotty/TODO      |  1 -
 src/devices/grotty/grotty.am |  3 +--
 src/devices/grotty/tty.cpp   |  5 ++++-
 4 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b32662c5f..3bee99d83 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2025-10-26  G. Branden Robinson <[email protected]>
+
+       * src/devices/grotty/tty.cpp (tty_printer::end_page): When using
+       hard tabs (per the `-h` option), use a space instead of a tab to
+       advance the output position when the distance to the next tab
+       stop is only one character cell.  This behavior more closely
+       resembles that of AT&T nroff.
+       * src/devices/grotty/TODO: Delete.  Its only item is resolved.
+       * src/devices/grotty/grotty.am (EXTRA_DIST): Drop "TODO".
+
+       Fixes <https://savannah.gnu.org/bugs/?67633>.  Problem
+       originally recorded by James Clark in groff 1.06, September
+       1992.
+
 2025-10-26  G. Branden Robinson <[email protected]>
 
        * src/devices/grotty/tty.cpp (tty_printer::special_link): Fix
diff --git a/src/devices/grotty/TODO b/src/devices/grotty/TODO
deleted file mode 100644
index 5db4221f7..000000000
--- a/src/devices/grotty/TODO
+++ /dev/null
@@ -1 +0,0 @@
-With -h avoid using a tab when a single space will do.
diff --git a/src/devices/grotty/grotty.am b/src/devices/grotty/grotty.am
index 67d241ea9..064417af9 100644
--- a/src/devices/grotty/grotty.am
+++ b/src/devices/grotty/grotty.am
@@ -30,8 +30,7 @@ dist_grottytmac_DATA = $(GROTTYTMACFILES)
 
 man1_MANS += src/devices/grotty/grotty.1
 EXTRA_DIST += \
-  src/devices/grotty/grotty.1.man \
-  src/devices/grotty/TODO
+  src/devices/grotty/grotty.1.man
 
 grotty_TESTS = \
   src/devices/grotty/tests/basic_latin_glyphs_map_correctly.sh \
diff --git a/src/devices/grotty/tty.cpp b/src/devices/grotty/tty.cpp
index 2b40cfe6a..a3449c64c 100644
--- a/src/devices/grotty/tty.cpp
+++ b/src/devices/grotty/tty.cpp
@@ -863,7 +863,10 @@ void tty_printer::end_page(int page_length)
                putstring(SGR_NO_UNDERLINE);
              is_underlining = false;
            }
-           putchar('\t');
+           if ((next_tab_pos - hpos) > 1)
+             putchar('\t');
+           else
+             putchar(' ');
            hpos = next_tab_pos;
          }
        }

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

Reply via email to