gbranden pushed a commit to branch master
in repository groff.

commit 3fb05670bf242dd12d45fb07fed0df0e93644710
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sat Dec 6 04:54:20 2025 -0600

    [troff]: Tweak `pstream` request output.
    
    * src/roff/troff/input.cpp (print_stream_request): Tweak JSON output,
      following model in "node.cpp"'s `dump_node_list_in_reverse()` (but
      using `errprint()` instead of fputc(3)).  Fixes extra spaces in list
      notation.
---
 ChangeLog                | 7 +++++++
 src/roff/troff/input.cpp | 8 ++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 45baeca0b..b816628ef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2025-12-06  G. Branden Robinson <[email protected]>
+
+       * src/roff/troff/input.cpp (print_stream_request): Tweak JSON
+       output, following model in "node.cpp"'s
+       `dump_node_list_in_reverse()` (but using `errprint()` instead of
+       fputc(3)).  Fixes extra spaces in list notation.
+
 2025-12-06  G. Branden Robinson <[email protected]>
 
        * src/utils/xtotroff/xtotroff.c (MapFont, main): Tweak wording
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 83e9d76fe..757a28cdd 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -8082,7 +8082,7 @@ static void print_stream_request()
   object_dictionary_iterator iter(stream_dictionary);
   symbol stream_name;
   grostream *grost;
-  errprint("[ ");
+  errprint("[");
   bool need_comma = false;
   while (iter.get(&stream_name, (object **)&grost)) {
     assert(!stream_name.is_null());
@@ -8100,7 +8100,11 @@ static void print_stream_request()
       need_comma = true;
     }
   }
-  errprint(" ]\n");
+  // !need_comma implies that the list was empty.  JSON convention is to
+  // put a space between an empty pair of square brackets.
+  if (!need_comma)
+    errprint(" ");
+  errprint("]\n");
   fflush(stderr);
   skip_line();
 }

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

Reply via email to