gbranden pushed a commit to branch master
in repository groff.

commit 04517e82e5cbd50f9b716b9825a0e2420e8b1b3b
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sat Mar 14 10:32:32 2026 -0500

    [troff]: Fix Savannah #68151.
    
    * src/roff/troff/env.cpp (environment::space): Throw warning in category
      "style" if the end of a sentence is detected before the end of a text
      line.
    
    * doc/groff.texi.in (Warnings):
    * src/roff/troff/troff.1.man (Warnings): Document it.
    
    Fixes <https://savannah.gnu.org/bugs/?68151>.  Thanks to Alex Colomar
    for the original feature request.
    
    ANNOUNCE: Acknowledge Alex.
---
 ANNOUNCE                   |  1 +
 ChangeLog                  | 12 ++++++++++++
 doc/groff.texi.in          |  3 ++-
 src/roff/troff/env.cpp     |  2 ++
 src/roff/troff/troff.1.man |  3 ++-
 5 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/ANNOUNCE b/ANNOUNCE
index 9c963e169..a951b7bc4 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -207,6 +207,7 @@ of this release.
    instance with "grep -i -A1 thanks ChangeLog".  A manual merge of
    similar from the contrib/ change log files may also be necessary. ]]
 
+Alex Colomar
 Bob Friesenhahn
 Bruno Haible
 Zack Weinberg
diff --git a/ChangeLog b/ChangeLog
index 1c3d493d4..fead03ec8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2026-03-14  G. Branden Robinson <[email protected]>
+
+       * src/roff/troff/env.cpp (environment::space): Throw warning in
+       category "style" if the end of a sentence is detected before the
+       end of a text line.
+
+       * doc/groff.texi.in (Warnings):
+       * src/roff/troff/troff.1.man (Warnings): Document it.
+
+       Fixes <https://savannah.gnu.org/bugs/?68151>.  Thanks to Alex
+       Colomar for the original feature request.
+
 2026-03-14  G. Branden Robinson <[email protected]>
 
        * src/roff/troff/input.cpp (struct warning_category): Add new
diff --git a/doc/groff.texi.in b/doc/groff.texi.in
index 6c7f615f1..137a93caf 100644
--- a/doc/groff.texi.in
+++ b/doc/groff.texi.in
@@ -21603,7 +21603,8 @@ ambiguous delimiters are accepted without warning.
 @itemx 16
 Input was non-idiomatic or likely to produce an unexpected result
 (or none at all),
-but is not invalid.
+but is not invalid:
+the end of a sentence was detected prior to the end of a text line.
 
 @item scale
 @itemx 32
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index db0aecd1f..b9db99ca1 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -566,6 +566,8 @@ void environment::space(hunits space_width, hunits 
sentence_space_width)
       && node_list_ends_sentence(p->next) == 1) {
     hunits xx = translate_space_to_dummy ? H0 : sentence_space_width;
     if (p->did_space_merge(xx, space_width, sentence_space_width)) {
+      warning(WARN_STYLE, "end of sentence detected before end of text"
+             " line");
       *tp += xx;
       return;
     }
diff --git a/src/roff/troff/troff.1.man b/src/roff/troff/troff.1.man
index 341a5a658..0cf7bcf93 100644
--- a/src/roff/troff/troff.1.man
+++ b/src/roff/troff/troff.1.man
@@ -812,7 +812,8 @@ T}
 style  16      T{
 Input was non-idiomatic or likely to produce an unexpected result
 (or none at all),
-but is not invalid.
+but is not invalid:
+the end of a sentence was detected prior to the end of a text line.
 T}
 .
 .

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

Reply via email to