bugGNU roff - Bugs: bug #46914, .ce sometimes ignores right margin

 
 

bug #46914: .ce sometimes ignores right margin

Submitter:  Dave <barx>
Submitted:  Sun 17 Jan 2016 01:06:09 AM UTC
 
Category:  Core Severity:  3 - Normal
Item Group:  Incorrect behaviour Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open Planned Release:  None
* Mandatory Fields

Add a New Comment (Rich Markup)
   

Thu 30 Mar 2023 09:07:08 PM UTC, comment #5: 

When filling is enabled and `ce` is used, not only does automatic breaking still take place in spite of no filling proper taking place, but adjustment does too!

You just need an example that reveals it.


$ cat ATTIC/ce2.roff
.de FR
Text can be centered with `.ce' (optionally with `.nf'
to suppress automatic breaks) or with `.ad c'.
..
.ll 4i
.ce 1000
.FR
.ce 0

.nf
.ce 1000
.FR
.ce 0
.fi

.na
.ce 1000
.FR
.ce 0

.ad c
.FR
.pl \n(nlu
$ nroff -Tascii ATTIC/ce2.roff
Text can be centered with `.ce' (option-
            ally with `.nf'
to suppress automatic  breaks)  or  with
                `.ad c'.

Text can be centered with `.ce' (optionally with `.nf'
to suppress automatic breaks) or with `.ad c'.

Text can be centered with `.ce' (option-
            ally with `.nf'
to suppress automatic breaks) or with
                `.ad c'.

Text can be centered with `.ce' (option-
 ally with `.nf' to suppress automatic
        breaks) or with `.ad c'.


Count the spaces in the first exhibit.


to suppress automatic  breaks)  or  with


This does not seem useful; if you add inter-word spaces until the line reaches the length limit, it is not distinguishable from centering.

Also, why is the first output line generated from the input line beginning with "to suppress" not centered in the third `FR` call's output?

Presumably some combinations were not checked long ago which is why the bug in comment #0 and this/these escaped notice.  It's possible they're all even the same bug.

If not, I'll spin this/these out into as many new tickets as are necessary.

It doesn't take a spirit medium to see regression tests in the future.

G. Branden Robinson <gbranden>
Project Administrator
Thu 30 Mar 2023 06:36:31 PM UTC, comment #4: 

comment #1:

> But bug #60731 raises the question of whether the actual bug
> above is in the output of the second or the third .ce call.  One
> of them seems to be wrong, since they handle the same situation
> (input longer than the requested output line) differently (one
> breaking the line, one overflowing the line length).


Further analysis in yonder 60731 seems to indicate that the breaking is the intended behavior (my assumption when I initially reported this).

Dave <barx>
Project Member
Sun 20 Feb 2022 04:27:47 AM UTC, comment #3: 

Given the input file of comment #2, Heirloom nroff breaks none of the centered lines.  Its output:

12345678901234567890
Some  line with long
singleword
Some line with long singleword
Some line with long singleword
Some line with longe singleword
Some line with longer singleword

Someone with easy access to one of the old Unix simulators can determine whether the above reflects AT&T nroff behavior (it probably does, as Heirloom is a derivative of that codebase), but the upshot is that groff seemingly does not behave the way it does in order to conform to some historical implementation.

Dave <barx>
Project Member
Fri 18 Feb 2022 02:05:17 AM UTC, comment #2: 

  The line is only split, if a space is after a non-space in the
excessive part of the line.

  Script:

.pl 20v
.fam C
.\".ll 20u*\w' 'u
.ll (u;20*\w' ')
.ad b\" (usually) default
12345678901234567890
Some line with long singleword\"
.ce 4
Some line with long singleword\" No break
Some line with long singleword \" With a break
Some line with longe singleword\" No break
Some line with longer singleword\" With a break

  Result (test-nroff) :

12345678901234567890
Some  line with long
singleword
Some line with long singleword
Some line with  long
     singleword
Some line with longe singleword
Some    line    with
 longer singleword


Bjarni Ingi Gislason <bjarniig>
Sat 05 Jun 2021 09:16:03 AM UTC, comment #1: 

You can see the bug in nroff output too; just edit the example input file to change the line length from 2i to 38n.  The terminal output from this (using groff 1.23.0.rc1) is:


some  text  some  text  some text some
text some text  some  text  some  text
some  text  some  text  some text some
text some text

          some centered text

some text some  text  some  text  some
text  some  text  some  text some text
some text some  text  some  text  some
text some text

quite a bit more centered text in this case

some  text  some  text  some text some
text some text  some  text  some  text
some  text  some  text  some text some
text some text

so, quite a bit more centered text  in
              this case

some  text  some  text  some text some
text some text  some  text  some  text
some  text  some  text  some text some
text some text


The line beginning with "quite," which spills over the right margin, is what this bug was originally opened to report.  But bug #60731 raises the question of whether the actual bug above is in the output of the second or the third .ce call.  One of them seems to be wrong, since they handle the same situation (input longer than the requested output line) differently (one breaking the line, one overflowing the line length).

Dave <barx>
Project Member
Sun 17 Jan 2016 01:06:09 AM UTC, original submission:  

I see this bug in groff 1.22.2.

A line centered with .ce can sometimes extend past the right margin.  Adding enough text eventually causes the line to be broken so it correctly stays within the margins.  The bug is illustrated in the second centered example below.

.ll 2i
some text some text some text some text some text some text
some text some text some text some text some text some text
.sp
.ce
some centered text
.sp
some text some text some text some text some text some text
some text some text some text some text some text some text
.sp
.ce
quite a bit more centered text in this case
.sp
some text some text some text some text some text some text
some text some text some text some text some text some text
.sp
.ce
so, quite a bit more centered text in this case
.sp
some text some text some text some text some text some text
some text some text some text some text some text some text

Dave <barx>
Project Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by gbranden (Posted a comment)
  • -email is unavailable- added by bjarniig (Posted a comment)
  • -email is unavailable- added by bgarrigues (Updated the item)
  • -email is unavailable- added by barx (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

     

     

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-09-01 bgarrigues CategoryNone Core

    Back to the top

    Powered by Savane 3.11