bug-groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #46914] .ce sometimes ignores right margin


From: Bjarni Ingi Gislason
Subject: [bug #46914] .ce sometimes ignores right margin
Date: Sat, 15 Apr 2023 20:12:15 -0400 (EDT)

Follow-up Comment #7, bug #46914 (project groff):

  The documentation in CSTR#54 and in Heirloom
(https://heirloom-doctools/doc/troff/doc.ps) are silent about fill
mode, but one can deduce from the text, that neither filling nor
breaking of input lines is done.

  This also makes sense as centering and filling are incompatible
goals.

  Thus the groff code does not do the sensible thing.

  The variable "was_centered" is not used in the current subroutine
"possible_break_line".


####

src/roff/troff/env.cpp: possibly_break_line: return at once, if lines
 are to be centered and fill mode is active

  Lines to be centered should neither be filled nor broken.
This shows a defect in the input file's layout.

####

  Line numbers might be different.

--- src/roff/troff/env.cpp      2023-04-15 22:05:43.000000000 +0000
+++ ../new-groff/src/roff/troff/env.cpp 2023-04-15 21:49:42.000000000 +0000
@@ -2119,6 +2127,12 @@ void environment::possibly_break_line(in
   int was_centered = center_lines > 0;
   if (!fill || current_tab || current_field || dummy)
     return;
+  if (was_centered && fill) {
+//  Centered lines should not be broken and not in fill mode
+//    warning(WARN_BREAK,
+//     "centering (.ce) and filling (.fi) are incompatible goals");
+    return;
+  }
   while (line != 0
         && (forced
             // When a macro follows a paragraph in fill mode, the

####

Provided input file "ce.roff" with default .fi and .ad b.

.ll 4i
.ad b\" default by me is .ad l
.fi
.ce 100
This is a small text fragment that shows the differences
between the `.ce' (with and without `.nf`) and the `.ad c' requests.
.ce 0
.sp
.nf
.ce 100
This is a small text fragment that shows the differences
between the `.ce' (with and without `.nf`) and the `.ad c' requests.
.ce 0
.sp
.fi
.ad c
This is a small text fragment that shows the differences
between the `.ce' (with and without `.nf`) and the `.ad c' requests.
.pl \n(nlu


####:

Output from "test-nroff -b -ww ce.roff":

This is a small text fragment that shows the differences
between the `.ce' (with and without `.nf`) and the `.ad c' requests.

This is a small text fragment that shows the differences
between the `.ce' (with and without `.nf`) and the `.ad c' requests.

This is a small text fragment that shows
the differences between the `.ce' (with
 and without `.nf`) and the `.ad c' re-
                quests.




    _______________________________________________________

Reply to this item at:

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

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]