URL:
  <https://savannah.gnu.org/bugs/?67570>

                 Summary: "cflags 1" sometimes ignored when used on a class
                   Group: GNU roff
               Submitter: barx
               Submitted: Thu 02 Oct 2025 04:39:17 PM CDT
                Category: Core
                Severity: 3 - Normal
              Item Group: Incorrect behaviour
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Thu 02 Oct 2025 04:39:17 PM CDT By: Dave <barx>
The below examples compare behavior of groff 1.23 and a current groff build.
The problem only came into groff in the last two months, but I no longer have
that two-months-ago build for direct comparison.

This exercise uses ".cflags 1" to make the em dash a sentence-ending
character.  So when an em dash is last on a line, it should be treated as the
end of a sentence.

First, let's set the cflag on the character directly.

$ cat direct.roff
.cflags 1 \[em]
I\[em]
fold.
$ groff-latest --version | head -1
GNU groff version 1.23.0.3991-48d2f-dirty
$ diff <(groff -Z direct.roff) <(groff-latest -Z direct.roff)
8,9d7
< V12000
< H72000
11a10,11
> V12000
> H72000

I don't know why those two lines moved a bit in grout, but no matter: this has
no effect on the output.  Typeset results are identical in 1.23 and current
groff.

Now let's put the em dash in a class, and set the cflag on that.

$ cat indirect.roff
.class [EOS] \[em]
.cflags 1 \C'[EOS]'
I\[em]
fold.
$ diff <(groff -Z indirect.roff) <(groff-latest -Z indirect.roff)
8,9d7
< V12000
< H72000
11a10,11
> V12000
> H72000
14c14
< wh15000
---
> wh12500

The horizontal movement has changed between groff 1.23 (in fact, groff of
August 2025) and today.  The latest groff no longer adds the extra sentence
space when the cflags value is applied to a class rather than to the character
directly.

Looked at another way, the files direct.roff and indirect.roff should behave
the same: they're defining the same sentence-ending character in different
ways.  And they used to, but now do not:

$ diff <(groff -Z direct.roff) <(groff -Z indirect.roff)
$ diff <(groff-latest -Z direct.roff) <(groff-latest -Z indirect.roff)
14c14
< wh15000
---
> wh12500

One curious twist: if we indicate the end of sentence to groff by using two
spaces instead of the end of the line, the problem goes away.

$ cat alternate.roff
.class [EOS] \[em]
.cflags 1 \C'[EOS]'
I\[em]  fold.
$ groff -Z alternate.roff | grep ^wh
wh15000
$ groff-latest -Z alternate.roff | grep ^wh
wh15000









    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?67570>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature

Reply via email to