gbranden pushed a commit to branch master
in repository groff.

commit 92db06544075ac78eea44bb05989168aac446d3e
Author: G. Branden Robinson <[email protected]>
AuthorDate: Fri Feb 6 13:36:03 2026 -0600

    src/roff/troff/env.cpp: Fix Savannah #68026.
    
    * src/roff/troff/env.cpp: Revert refactoring from commit 8b165f90ef, 29
      December, which caused spurious "spurious end trap token detected!"
      error diagnostics when breaking pages with Matt Bishop's "mn" macro
      package (used by the NetHack Guidebook).  Because a variable was
      renamed later the same day, this reversion was done by hand.  Still to
      be understood: why the `br` request handler needs to use
      `token::next()` instead of `skip_line()` as most request handlers do.
    
    Fixes <https://savannah.gnu.org/bugs/?68026>.
---
 ChangeLog              | 28 +++++++++++++---------------
 src/roff/troff/env.cpp | 17 +++++++++++------
 2 files changed, 24 insertions(+), 21 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index da0df963e..1efe87f1f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2026-02-06  G. Branden Robinson <[email protected]>
+
+       * src/roff/troff/env.cpp: Revert refactoring from commit
+       8b165f90ef, 29 December, which caused spurious "spurious end
+       trap token detected!" error diagnostics when breaking pages with
+       Matt Bishop's "mn" macro package (used by the NetHack
+       Guidebook).  Because a variable was renamed later the same day,
+       this reversion was done by hand.  Still to be understood: why
+       the `br` request handler needs to use `token::next()` instead of
+       `skip_line()` as most request handlers do.
+
+       Fixes <https://savannah.gnu.org/bugs/?68026>.
+
 2026-02-06  G. Branden Robinson <[email protected]>
 
        * update-copyright.sh: Drop (unshipped) script.  I implement a
@@ -851,21 +864,6 @@
        * src/roff/troff/div.cpp: Include local "input.h" header file to
        get at the symbol's relocated declaration.
 
-2025-12-29  G. Branden Robinson <[email protected]>
-
-       * src/roff/troff/env.cpp: Refactor.  Further separate input
-       processing logic from engine logic.
-       (environment::do_break): Rename argument from `want_adjustment`
-       to `want_forced_adjustment` for clarity.
-       (break_output_line): Stop checking value of `want_break` global
-       here, as that's determined by the input control character used
-       to invoke the request, a front-end rather than an engine concern
-       {albeit brearing an engine-oriented name}.  However, removing
-       that conditional leaves this function as a one-liner with two
-       call sites differing only by a Boolean literal argument, so drop
-       the function altogether, instead open-coding it...
-       (break_without_adjustment, break_without_adjustment): ...here.
-
 2025-12-29  G. Branden Robinson <[email protected]>
 
        [groff]: Unit-test `br` and `brp` requests.
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index b49471f2a..90880c3fe 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -2645,18 +2645,23 @@ bool environment::is_empty()
          && pending_lines == 0 /* nullptr */;
 }
 
-static void break_without_forced_adjustment_request()
+void do_break_request(bool want_adjustment)
 {
+  while (!tok.is_newline() && !tok.is_eof())
+    tok.next();
   if (was_invoked_with_regular_control_character)
-    curenv->do_break(false /* want forced adjustment */);
-  skip_line();
+    curenv->do_break(want_adjustment);
+  tok.next();
+}
+
+static void break_without_forced_adjustment_request()
+{
+  do_break_request(false);
 }
 
 static void break_with_forced_adjustment_request()
 {
-  if (was_invoked_with_regular_control_character)
-    curenv->do_break(true /* want forced adjustment */);
-  skip_line();
+  do_break_request(true);
 }
 
 void title()

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

Reply via email to