groff
[Top][All Lists]
Advanced

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

[PATCH 6/7] src/roff/troff/input.cpp: Fix Savannah #45502.


From: G. Branden Robinson
Subject: [PATCH 6/7] src/roff/troff/input.cpp: Fix Savannah #45502.
Date: Tue, 9 Apr 2024 23:53:45 -0500

* src/roff/troff/input.cpp (skip_branch): Handle a degenerate control
  flow branch correctly (as AT&T troff does); if the branch consists
  only of a newline immediately after a false predicate, it still
  counts.  Similarly, an `el`(se) branch that gets taken and is followed
  only by a newline puts a break on the output (a line break if filling
  is disabled).

Fixes <https://savannah.gnu.org/bugs/?45502>.  Thanks to Carsten Kunze
for the report and to Dave Kemper for the code review.
---
 ANNOUNCE                 |  1 +
 ChangeLog                | 12 ++++++++++++
 src/roff/troff/input.cpp |  4 ++++
 3 files changed, 17 insertions(+)

diff --git a/ANNOUNCE b/ANNOUNCE
index 9a0d2845a..66f8ec2a6 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -162,6 +162,7 @@ Alexis ("no, the other one")
 Bjarni Ingi Gislason
 Brian Inglis
 Bruno Haible
+Carsten Kunze
 Colin Watson
 Damian McGuckin
 Dave Kemper
diff --git a/ChangeLog b/ChangeLog
index d41cfdf2b..2c0291e46 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2024-04-05  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * src/roff/troff/input.cpp (skip_branch): Handle a degenerate
+       control flow branch correctly (as AT&T troff does); if the
+       branch consists only of a newline immediately after a false
+       predicate, it still counts.  Similarly, an `el`(se) branch that
+       gets taken and is followed only by a newline puts a break on the
+       output (a line break if filling is disabled).
+
+       Fixes <https://savannah.gnu.org/bugs/?45502>.  Thanks to Carsten
+       Kunze for the report and to Dave Kemper for the code review.
+
 2024-04-05  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * src/roff/troff/input.cpp: Trivially refactor.  Rename
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index cac51d1a6..5c53217fc 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -5880,6 +5880,10 @@ static void troff_request()
 
 static void skip_branch()
 {
+  if (tok.is_newline()) {
+    tok.next();
+    return;
+  }
   int level = 0;
   // ensure that ".if 0\{" works as expected
   if (tok.is_left_brace())
-- 
2.30.2

Attachment: signature.asc
Description: PGP signature


reply via email to

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