gbranden pushed a commit to branch master
in repository groff.

commit 3c70cb50b500384393df39001b72ac447308d899
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sat Dec 13 17:12:36 2025 -0600

    [troff]: Revise `\f` after `\c` handling.
    
    * src/roff/troff/env.cpp (environment::set_font): Move warning thrown
      (and recast it, and change its category from "font" to "syntax") when
      font selection attempted on the ignored part of an input line
      interrupted/continued with `\c` from here...
    * src/roff/troff/input.cpp (token::next): ...to here.
    
    * doc/groff.texi.in (Warnings):
    * man/groff_diff.7.man (Warnings): Simplify description of warning
      category "font" accordingly.
---
 ChangeLog                  | 12 ++++++++++++
 doc/groff.texi.in          |  6 ++----
 src/roff/troff/env.cpp     |  4 +---
 src/roff/troff/input.cpp   |  6 ++++++
 src/roff/troff/troff.1.man |  5 +----
 5 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b050d498f..df6abf605 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2025-12-13  G. Branden Robinson <[email protected]>
+
+       * src/roff/troff/env.cpp (environment::set_font): Move warning
+       thrown (and recast it, and change its category from "font" to
+       "syntax") when font selection attempted on the ignored part of
+       an input line interrupted/continued with `\c` from here...
+       * src/roff/troff/input.cpp (token::next): ...to here.
+
+       * doc/groff.texi.in (Warnings):
+       * man/groff_diff.7.man (Warnings): Simplify description of
+       warning category "font" accordingly.
+
 2025-12-15  G. Branden Robinson <[email protected]>
 
        * src/roff/troff/env.cpp
diff --git a/doc/groff.texi.in b/doc/groff.texi.in
index 9888b4e2e..a031f100e 100644
--- a/doc/groff.texi.in
+++ b/doc/groff.texi.in
@@ -20104,10 +20104,8 @@ occurs in compatibility mode.
 
 @item font
 @itemx 131072
-A non-existent font was selected, or the selection was ignored because a
-font selection escape sequence was used after the output line
-continuation escape sequence on an input line.  This category is enabled
-by default.
+A non-existent font was selected.
+This category is enabled by default.
 
 @item ig
 @itemx 262144
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index 17128fd4d..112f603df 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -604,10 +604,8 @@ static void warn_if_font_name_deprecated(symbol nm)
 
 bool environment::set_font(symbol nm)
 {
-  if (was_line_interrupted) {
-    warning(WARN_FONT, "ignoring font selection on interrupted line");
+  if (was_line_interrupted)
     return true; // "no operation" is successful
-  }
   // TODO: Kill this off in groff 1.24.0 release + 2 years.
   if (is_device_ps_or_pdf)
     warn_if_font_name_deprecated(nm);
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 311352860..7db0fda5f 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -2458,6 +2458,12 @@ void token::next()
                  " AT&T troff", char(cc));
        goto handle_escape_char;
       case 'f':
+       if (curenv->get_was_line_interrupted()) {
+         warning(WARN_SYNTAX, "ignoring escaped '%1' on input line"
+                 " after output line continuation escape sequence",
+                 char(cc));
+         break;
+       }
        select_font(read_escape_parameter(ALLOW_EMPTY));
        if (!want_att_compat)
          have_formattable_input = true;
diff --git a/src/roff/troff/troff.1.man b/src/roff/troff/troff.1.man
index d6ba11985..1f91d6373 100644
--- a/src/roff/troff/troff.1.man
+++ b/src/roff/troff/troff.1.man
@@ -693,10 +693,7 @@ T}
 .
 .sp \n[PD]u
 font   131072  T{
-A non-existent font was selected,
-or the selection was ignored because a font selection escape sequence
-was used after the output line continuation escape sequence on an input
-line.
+A non-existent font was selected.
 .
 This category is enabled by default.
 T}

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

Reply via email to