groff
[Top][All Lists]
Advanced

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

[Groff] broken interaction between line numbering and diversions


From: Dave Kemper
Subject: [Groff] broken interaction between line numbering and diversions
Date: Wed, 17 Sep 2014 09:20:04 -0500

.nm +1
Text before diversion.
Text before diversion.
Text before diversion.
Text before diversion.
Text before diversion.
Text before diversion.
Text before diversion.
Text before diversion.
.br
.di my_diversion
Diverted text.
Diverted text.
Diverted text.
Diverted text.
Diverted text.
Diverted text.
Diverted text.
Diverted text.
Diverted text.
Diverted text.
Diverted text.
Diverted text.
Diverted text.
Diverted text.
Diverted text.
Diverted text.
Diverted text.
.di
.my_diversion
Text after diversion.
Text after diversion.
Text after diversion.
Text after diversion.
Text after diversion.
Text after diversion.

The problem with the above input can be seen in either text or
PostScript output in groff 1.22.2.  Using nroff, the output is

  1 Text  before  diversion.  Text before diversion.  Text before di-
  2 version.  Text before diversion.  Text  before  diversion.   Text
  3 before diversion.  Text before diversion.  Text before diversion.
  8 Diverted  text.     4 Diverted  text.   Diverted  text.  Diverted
  9 text.  Diverted text.   5 Diverted text.  Diverted text.  Divert-
 10 ed  text.   Diverted  text.   6 Diverted  text.   Diverted  text.
 11 Diverted text.  Diverted text.   7 Diverted text.  Diverted text.
 12 Diverted  text.   Diverted  text. Text after diversion.  Text af-
 13 ter diversion.  Text  after  diversion.   Text  after  diversion.
 14 Text after diversion.  Text after diversion.

When I opened a report in the bug tracker on this, Werner responded
that this is working as designed.  While I understand the design of
how diversions are implemented, and why that implementation might
produce these results, I contend that this design is so poor as to be
fundamentally broken, for the following reasons:

 - It behaves in a manner that no real-world user would ever want.

 - It violates the principle of least astonishment.

 - Changing it presents no realistic backward-compatibility issues:
the current behavior is undocumented, and scattering incorrect line
numbers in random places throughout a block of text is not a "feature"
that any existing roff documents are likely taking advantage of.

Further, the fix should be fairly simple: it's trivial in the roff
document to turn off line numbering before the diversion definition,
and back on again after the end of the definition, and doing this
produces rational results that are most likely to be what the user
wants anyway.  So groff would merely need to flip this switch
automatically, without explicit user intervention.

Even if it is deemed correct to doubly number lines in a
diversion--once when the diversion is defined, and once when it is
output--it surely cannot be correct that the former set of numbers is
intermixed with the text.  After all, it *is* documented that line
numbers should appear in the left margin.

During this list's "future of groff" discussion a little while ago, a
recurring sentiment was that if groff is to have a future at all, it
must act in ways that seem sane to a user in the 21st century, not
just to users who began using it in the 1970s.  I believe fixing
problems like this moves in that direction.

What are the groff community's thoughts on this?



reply via email to

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