gbranden pushed a commit to branch master
in repository groff.

commit 0b447b2f3972a577dfca70be34bce9519be982ac
Author: G. Branden Robinson <[email protected]>
AuthorDate: Mon Nov 2 21:08:59 2026 -0600

    src/roff/troff/div.cpp: Fix Savannah #68868.
    
    * src/roff/troff/div.cpp (need_vertical_space_request): Revise `ne`
      request behavior; perform no operation if the argument is invalid.
      Our documentation already said this was the case, but while the
      request threw an error diagnostic, it proceeded as if `.ne 1v` (or,
      equivalently, simply `.ne`) had been specified.
    
    Fixes <https://savannah.gnu.org/bugs/?68868>.
    
    NEWS: Add item.
---
 ChangeLog              | 10 ++++++++++
 NEWS                   |  4 ++++
 src/roff/troff/div.cpp |  8 +++++---
 3 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1d8eb631d..b2619a046 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2026-11-02  G. Branden Robinson <[email protected]>
+
+       * src/roff/troff/div.cpp (need_vertical_space_request): Revise
+       `ne` request behavior; perform no operation if the argument is
+       invalid.  Our documentation already said this was the case, but
+       while the request threw an error diagnostic, it proceeded as if
+       `.ne 1v` (or, equivalently, simply `.ne`) had been specified.
+
+       Fixes <https://savannah.gnu.org/bugs/?68868>.
+
 2026-11-02  G. Branden Robinson <[email protected]>
 
        [groff]: Regression-test Savannah #68868.
diff --git a/NEWS b/NEWS
index 0bc241507..a9491a41a 100644
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,10 @@ VERSION next
 troff
 -----
 
+*  The `ne` request no longer performs an operation if it is given an
+   invalid argument.  This change is inconsistent with AT&T troff but
+   more consistent with general *roff syntax.
+
 *  The `shift` request no longer performs an operation if it is given an
    invalid argument.
 
diff --git a/src/roff/troff/div.cpp b/src/roff/troff/div.cpp
index 46f970dd0..473d2791e 100644
--- a/src/roff/troff/div.cpp
+++ b/src/roff/troff/div.cpp
@@ -930,9 +930,11 @@ BEGIN_TRAP token is not skipped over. */
 
 static void need_vertical_space_request() // .ne
 {
-  vunits n;
-  if (!has_arg() || !read_vunits(&n, 'v'))
-    n = curenv->get_vertical_spacing();
+  vunits n = curenv->get_vertical_spacing();
+  if (has_arg() && !read_vunits(&n, 'v')) {
+    skip_line();
+    return;
+  }
   if (n < V0) {
     warning(WARN_RANGE, "ignoring request to require negative amount"
                        " of vertical space: %1u", n.to_units());

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

Reply via email to