[bug #64005] [ms] fix for Savannah #62688 suppresses page breaks between displays

2024-05-29 Thread Deri James
Update of bug #64005 (group groff):

  Status:   Fixed => Need Info  
 Open/Closed:  Closed => Open   

___

Follow-up Comment #7:

I think there may be a problem with this fix.

The fix:-

+.\" Wrap the `bp` request so that we disregard the enablement of
+.\" no-space mode, which we enter after displays and equations to
+.\" prevent multiple sources of vertical space (like the DD and PD
+.\" registers) from incorrectly accumulating.  Thus, if the user
+.\" requests a page break, we honor it.  See Savannah #62688 & #64005.
+.als @break-page bp
+.de bp
+.  nr @saved-no-space-mode \\n[.ns]
+.  rs
+.  ie \\n[.br] '@break-page \\$1
+.  el  .@break-page \\$1
+.  if \\n[@saved-no-space-mode] .ns
+.  rr @saved-no-space-mode
+..
+.

In the groff_book the documentation of the .br register has this code
snippet:-

.als bp*orig bp
.de bp
. tm before bp
. ie \\n[.br] .bp*orig
. el ’bp*orig
. tm after bp
..

Very similar, but the break/non-break versions of bp are round the other way.
This seems to cause a problem:-

[derij@pip build (jpeg)]$ printf "
What is Lorem Ipsum?

Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,
when an unknown printer took a galley of type and scrambled it to make a type
specimen book. It has survived not only five centuries, but also the leap into
electronic typesetting, remaining essentially unchanged. It was popularised in
the 1960s with the release of Letraset sheets containing Lorem Ipsum passages,
and more recently with desktop publishing software like Aldus PageMaker.
.bp\nPage 2"|groff -ms -a

Results in:-


What is Lorem Ipsum?
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's
standard dummy text ever since the 1500s, when an unknown printer took a
galley of type and scrambled it to make
a type specimen book. It has survived not only five centuries, but also the
leap into electronic typesetting, remaining
essentially unchanged. It was popularised in the 1960s with the release of
Letraset sheets containing Lorem Ipsum
  

 -2- 
passages, and more recently with desktop publishing software like Aldus
PageMaker. Page 2

The partial line ending in "Aldus PageMaker" should be on page 1, it isn't. I
have not looked at the regression test associated with this bug, but it does
not seem to detect this issue.


___

Reply to this item at:

  

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




[bug #64005] [ms] fix for Savannah #62688 suppresses page breaks between displays

2023-07-10 Thread G. Branden Robinson
Update of bug #64005 (project groff):

  Status: Ready for Merge => Fixed  
 Open/Closed:Open => Closed 
 Planned Release:None => 1.24.0 

___

Follow-up Comment #6:

Fixed and regression-tested.


commit 5808f3f4dd8f39341170597363a6aaf7acf921fd
Author: G. Branden Robinson 
Date:   Wed Apr 5 20:04:17 2023 -0500

[ms]: Fix Savannah #64005.

* tmac/s.tmac (@break-page, bp): Define alias for `bp` request and
  wrapper for `bp` to (if needed) temporarily disable no-space mode, so
  that a document's `bp` requests are honored even if no-space mode is
  on, as can happen after displays.  Fixes a regression from groff
  1.22.4 and historical ms implementations introduced by me on 6 July
  when resolving Savannah #62688.

Fixes .  Thanks to Michał
Kruszewski for reporting the problem and Dave Kemper for identifying the
cause.

ANNOUNCE: Acknowledge Michał.

commit c30696d50f6a3a0c0a0597cde7933450e94805a6
Author: G. Branden Robinson 
Date:   Wed Apr 5 19:08:03 2023 -0500

[ms]: Regression-test Savannah #64005.

* tmac/tests/s_honor-page-break-after-display.sh: Do it.
* tmac/tmac.am (tmac_TESTS): Run test.

Test fails at this commit.




___

Reply to this item at:

  

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




[bug #64005] [ms] fix for Savannah #62688 suppresses page breaks between displays

2023-04-07 Thread G. Branden Robinson
Update of bug #64005 (project groff):

  Status: In Progress => Ready for Merge

___

Follow-up Comment #5:


commit 72820ac3e1fd4c3421486b80c6b791503ae268a7
Author: G. Branden Robinson 
Date:   Wed Apr 5 20:04:17 2023 -0500

[ms]: Fix Savannah #64005.

* tmac/s.tmac (@break-page, bp): Define alias for `bp` request and
  wrapper for `bp` to (if needed) temporarily disable no-space mode, so
  that a document's `bp` requests are honored even if no-space mode is
  on, as can happen after displays.  Fixes a regression from groff
  1.22.4 and historical ms implementations introduced by me on 6 July
  when resolving Savannah #62688.

Fixes .  Thanks to Michał
Kruszewski for reporting the problem and Dave Kemper for identifying the
cause.

ANNOUNCE: Acknowledge Michał.

commit 355a495a31b4560242067eeb8b9a46fe96bc3fa3
Author: G. Branden Robinson 
Date:   Wed Apr 5 19:08:03 2023 -0500

[ms]: Regression-test Savannah #64005.

* tmac/tests/s_honor-page-break-after-display.sh: Do it.
* tmac/tmac.am (tmac_TESTS): Run test.

Test fails at this commit.




___

Reply to this item at:

  

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




[bug #64005] [ms] fix for Savannah #62688 suppresses page breaks between displays

2023-04-05 Thread Dave
Follow-up Comment #4, bug #64005 (project groff):

[comment #3 comment #3:]
> Presumably the situation of interest is one where the document author
> invokes `ns`, interesting things happen, and then they invoke `bp`.

Right, or I was thinking more of a situation akin to the one that exposed this
bug: where an ms user defines some local macro that includes an .ns, and
somtimes calls that macro followed by a .bp.  Unless .de is also verboten to
ms users.

Anyway, this was an off-the-cuff observation; as a non-ms user, I'm in no
position to evaluate how valid the concern is, and what I glean from the rest
of your message is "not very."  I trust that anyone with real objections will
respond to the step-by-step proposal in the email thread.


___

Reply to this item at:

  

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




[bug #64005] [ms] fix for Savannah #62688 suppresses page breaks between displays

2023-04-05 Thread G. Branden Robinson
Update of bug #64005 (project groff):

  Status:   Confirmed => In Progress

___

Follow-up Comment #3:

[comment #2 comment #2:]
> [comment #0 original submission:]
> > An only slightly less simple remedy might be to wrap the `bp`
> > request, forcing no-space on, invoking the "real" `bp`, and then
> > restoring no-space mode (if it was enabled).
> 
> This would also cause .bp to start a new page even if the user has
explicitly invoked .ns, correct?  That would presumably diverge from
historical groff behavior, and possibly that of other roffs.

Yes.  But I'm not sure why you'd invoke `ns` and then immediately invoke `bp`.
 There are easier ways to do nothing.

Presumably the situation of interest is one where the document author invokes
`ns`, interesting things happen, and then they invoke `bp`.

I don't think `ns` and `rs` are what other macro packages (like me(7)) term
"safe requests".

The _only_ formatter requests that Lesk calls out in the Version 7 Unix ms
manual are `bp`, `br`, `sp`, and `na`.  He doesn't take as strong a line as
Allman did though, prefacing the foregoing with

> Among the useful commands from the basic formatting programs
> are the following.  They all work with both typesetter and
> computer terminal output:

He otherwise does not address the issue.  Given this, I'm tempted to regard
only those 4 foregoing requests as explicitly "blessed" by the package.  Maybe
I should add something to our doc/ms.ms about this.

The ms package uses `rs` and `ns` internally, and not lightly.  Even its
earliest available form, from Version 6 Unix, has several occurrences.


$ grep -rw -C1 '[nr]s' HISTORY-MS/1975-05-v6/
HISTORY-MS/1975-05-v6/tmac.s-.de TX
HISTORY-MS/1975-05-v6/tmac.s:.rs
HISTORY-MS/1975-05-v6/tmac.s-.if t .sp .5i
--
HISTORY-MS/1975-05-v6/tmac.s-.ft R
HISTORY-MS/1975-05-v6/tmac.s:.rs
HISTORY-MS/1975-05-v6/tmac.s-.ce 1000
--
HISTORY-MS/1975-05-v6/tmac.s-.di WB
HISTORY-MS/1975-05-v6/tmac.s:.rs
HISTORY-MS/1975-05-v6/tmac.s-.ce 1
--
HISTORY-MS/1975-05-v6/tmac.s-.sp 6
HISTORY-MS/1975-05-v6/tmac.s:.ns
HISTORY-MS/1975-05-v6/tmac.s-.if \\n(TV .TX
--
HISTORY-MS/1975-05-v6/tmac.s-.ll \\n(LLu
HISTORY-MS/1975-05-v6/tmac.s:.rs
HISTORY-MS/1975-05-v6/tmac.s-.sp 6
HISTORY-MS/1975-05-v6/tmac.s:.ns
HISTORY-MS/1975-05-v6/tmac.s-.if \\n(TV .TX
--
HISTORY-MS/1975-05-v6/tmac.s-.if t .sp 0.5
HISTORY-MS/1975-05-v6/tmac.s:.ns
HISTORY-MS/1975-05-v6/tmac.s-..
--
HISTORY-MS/1975-05-v6/tmac.s-.nr MF 0
HISTORY-MS/1975-05-v6/tmac.s:.ns
HISTORY-MS/1975-05-v6/tmac.s-.os
--
HISTORY-MS/1975-05-v6/tmac.s-.nr RO \\n(L2*8/7
HISTORY-MS/1975-05-v6/tmac.s:.ns
HISTORY-MS/1975-05-v6/tmac.s-..
--
HISTORY-MS/1975-05-v6/tmac.s-.nr x 0 1
HISTORY-MS/1975-05-v6/tmac.s:.ns
HISTORY-MS/1975-05-v6/tmac.s-..


(As an aside, check that out, man--classical ms is name space clobberific!  It
doesn't seem Lesk expected much use of `de`, `ds`, or `nr`, either.)

I want to say that if you use any other requests and your document breaks, you
get to keep both pieces, but that is doubtless too harsh.  It's always okay to
use `ab` and `tm`, for instance--I don't want to warn people off of tools that
are useful for troubleshooting!

In any event, for the immediate issue, I think Lesk's endorsement of `bp` can
decide the issue.  He clearly envisioned it being employed by document
authors.  `ns` does not enjoy such an endorsement.

Given the choice between breaking documents' use of `bp` and `ns`, the answer
seems clear.

What do you think?


___

Reply to this item at:

  

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




[bug #64005] [ms] fix for Savannah #62688 suppresses page breaks between displays

2023-04-05 Thread Dave
Follow-up Comment #2, bug #64005 (project groff):

[comment #0 original submission:]
> An only slightly less simple remedy might be to wrap the `bp`
> request, forcing no-space on, invoking the "real" `bp`, and then
> restoring no-space mode (if it was enabled).

This would also cause .bp to start a new page even if the user has explicitly
invoked .ns, correct?  That would presumably diverge from historical groff
behavior, and possibly that of other roffs.


___

Reply to this item at:

  

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




[bug #64005] [ms] fix for Savannah #62688 suppresses page breaks between displays

2023-04-05 Thread G. Branden Robinson
Update of bug #64005 (project groff):

Severity:  3 - Normal => 4 - Important  

___

Follow-up Comment #1:

Promoting to important severity since it regresses correct _groff_ 1.22.4
behavior.


___

Reply to this item at:

  

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




[bug #64005] [ms] fix for Savannah #62688 suppresses page breaks between displays

2023-04-05 Thread G. Branden Robinson
URL:
  

 Summary: [ms] fix for Savannah #62688 suppresses page breaks
between displays
   Group: GNU roff
   Submitter: gbranden
   Submitted: Wed 05 Apr 2023 11:02:47 PM UTC
Category: Macro ms
Severity: 3 - Normal
  Item Group: Incorrect behaviour
  Status: Confirmed
 Privacy: Public
 Assigned to: gbranden
 Open/Closed: Open
 Discussion Lock: Any
 Planned Release: None


___

Follow-up Comments:


---
Date: Wed 05 Apr 2023 11:02:47 PM UTC By: G. Branden Robinson 
The fix for bug #62688, to get more authentic-to-AT spacing between
displays, unfortunately also defeats user-requested page breaks between
displays.

This was [https://lists.gnu.org/archive/html/groff/2023-04/msg00022.html
reported by Michał Kruszewski to the groff development list].

Here is some sample input.


.LP
Hello.
This is page \n%.
.DS
display goes here
.DE
.bp
.LP
This is page \n%.
.pl \n(nlu


All of groff 1.22.4 ms, DWB 3.3 ms, Heirloom Doctools ms, and Version 7 Unix
ms honor the page break.  groff Git does not.

I had implemented the fix by simply kicking the formatter into no-space mode
after displays and equations.  It was the simplest solution I could think of.

Unfortunately, it was too simple.

Come up with something better, and add a regression test.

An only slightly less simple remedy might be to wrap the `bp` request, forcing
no-space on, invoking the "real" `bp`, and then restoring no-space mode (if it
was enabled).







___

Reply to this item at:

  

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