bug-groff
[Top][All Lists]
Advanced

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

[bug #63749] [tbl] available line length mismeasured when box option or


From: G. Branden Robinson
Subject: [bug #63749] [tbl] available line length mismeasured when box option or vertical lines used
Date: Fri, 3 Feb 2023 00:52:36 -0500 (EST)

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

                 Summary: [tbl] available line length mismeasured when box
option or vertical lines used
                 Project: GNU troff
               Submitter: gbranden
               Submitted: Fri 03 Feb 2023 05:52:34 AM UTC
                Category: Preprocessor tbl
                Severity: 3 - Normal
              Item Group: Incorrect behaviour
                  Status: In Progress
                 Privacy: Public
             Assigned to: gbranden
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Fri 03 Feb 2023 05:52:34 AM UTC By: G. Branden Robinson <gbranden>
Consider the following input.


.ll 64n
.nf
1234567890123456789012345678901234567890123456789012345678901234
.fi
.TS
L L L L L.
abandoning      babysitter      cablecasts      dachshunds      earmarkingX
.TE
.
.TS
| L L L L L.
abandoning      babysitter      cablecasts      dachshunds      earmarkingX
.TE
.
.TS
L L L L L |.
abandoning      babysitter      cablecasts      dachshunds      earmarkingX
.TE
.
.TS
| L L L L L |.
abandoning      babysitter      cablecasts      dachshunds      earmarkingX
.TE
.
.TS
doublebox;
L L L L L.
abandoning      babysitter      cablecasts      dachshunds      earmarkingX
.TE
.
.TS
box;
| L L L L L |.
abandoning      babysitter      cablecasts      dachshunds      earmarkingX
.TE
.
.TS
box tab(:);
Lz  S | Rt
Ld| Cb| ^
^ | Rz  S.
left:r
l:center:
:right
.TE
.TS
L,|||R.
foo
bar
.TE
.TS
L||R.
foo     bar
.TE
.pl \n(nlu


When formatting for a terminal device in groff 1.22.4, we see a lot of
problems.


$ groff -t -Tascii -P -cbou ATTIC/table64.roff 
warning: file 'ATTIC/table64.roff', around line 27:
  table wider than line width
warning: file 'ATTIC/table64.roff', around line 33:
  table wider than line width
warning: file 'ATTIC/table64.roff', around line 39:
  table wider than line width
1234567890123456789012345678901234567890123456789012345678901234
abandoning   babysitter   cablecasts   dachshunds   earmarkingX
|abandoning   babysitter   cablecasts   dachshunds   earmarkingX|
abandoning   babysitter   cablecasts   dachshunds   earmarkingX ||
|abandoning   babysitter   cablecasts   dachshunds   earmarkingX |
+----------------------------------------------------------------+
+----------------------------------------------------------------+
|abandoning   babysitter   cablecasts   dachshunds   earmarkingX |
+----------------------------------------------------------------+
+abandoning---babysitter---cablecasts---dachshunds---earmarkingX-+
+-----------+---+------------------------------------------------+
|left       | r |
|  | center |   |
|l |      right |
+foo------------+
|bar||
foo ||bar


The diagnostics are ugly (fixed in this commit
<https://git.savannah.gnu.org/cgit/groff.git/commit/?id=f75e156b621d3743368c58425f357e6cd52372a0>;
when vertical lines extend above the top of the table they overprint any
material already there (half of bug #62471, also see bug #63449);  and the
last line of a boxed table is overprinted by the last row of its data (bug
#49390).

Even with all those addressed we still see a problem or two in groff Git.


$ ./build/test-groff -t -Tascii -P -cbou ATTIC/table64.roff 
tbl:ATTIC/table64.roff:35: error: ignoring vertical line at leading edge of
boxed table
tbl:ATTIC/table64.roff:35: error: ignoring vertical line at trailing edge of
boxed table
tbl:ATTIC/table64.roff:47: error: more than 2 vertical lines at beginning of
row description
ATTIC/table64.roff:22: warning: table wider than line length minus
indentation
ATTIC/table64.roff:28: warning: table wider than line length minus
indentation
ATTIC/table64.roff:34: warning: table wider than line length minus
indentation
1234567890123456789012345678901234567890123456789012345678901234
abandoning   babysitter   cablecasts   dachshunds   earmarkingX
|
|abandoning   babysitter   cablecasts   dachshunds   earmarkingX
                                                                |
abandoning   babysitter   cablecasts   dachshunds   earmarkingX |
|                                                                |
|abandoning   babysitter   cablecasts   dachshunds   earmarkingX |
+----------------------------------------------------------------+
+----------------------------------------------------------------+
|abandoning   babysitter   cablecasts   dachshunds   earmarkingX |
+----------------------------------------------------------------+
+----------------------------------------------------------------+
+----------------------------------------------------------------+
|abandoning   babysitter   cablecasts   dachshunds   earmarkingX |
+----------------------------------------------------------------+
+-----------+---+
|left       | r |
|  | center |   |
|l |      right |
+--+------------+

|foo
|bar
    ||
foo ||bar


This is a lot better, but we get no diagnostics about the tables generated by
input lines 12 and 17 overrunning the line length.

This is because the measurements that the _roff_ code that _tbl_ generates
don't correctly take into account the fact that vertical lines take up 1n of
space on nroff devices.

If we address that, we see the following:


$ ./build/test-groff -t -Tascii -P -cbou ATTIC/table64.roff 
tbl:ATTIC/table64.roff:35: error: ignoring vertical line at leading edge of
boxed table
tbl:ATTIC/table64.roff:35: error: ignoring vertical line at trailing edge of
boxed table
tbl:ATTIC/table64.roff:47: error: more than 2 vertical lines at beginning of
row description
ATTIC/table64.roff:12: warning: table wider than line length minus
indentation
ATTIC/table64.roff:17: warning: table wider than line length minus
indentation
ATTIC/table64.roff:22: warning: table wider than line length minus
indentation
ATTIC/table64.roff:28: warning: table wider than line length minus
indentation
ATTIC/table64.roff:34: warning: table wider than line length minus
indentation
1234567890123456789012345678901234567890123456789012345678901234
abandoning   babysitter   cablecasts   dachshunds   earmarkingX
|
| abandoning   babysitter   cablecasts   dachshunds   earmarkingX
                                                                |
abandoning   babysitter   cablecasts   dachshunds   earmarkingX |
|                                                                 |
| abandoning   babysitter   cablecasts   dachshunds   earmarkingX |
+-----------------------------------------------------------------+
+-----------------------------------------------------------------+
| abandoning   babysitter   cablecasts   dachshunds   earmarkingX |
+-----------------------------------------------------------------+
+-----------------------------------------------------------------+
+-----------------------------------------------------------------+
| abandoning   babysitter   cablecasts   dachshunds   earmarkingX |
+-----------------------------------------------------------------+
+------------+---+
| left       | r |
|   | center |   |
| l |      right |
+---+------------+

| foo
| bar
    ||
foo ||bar


Now all of the overrunning tables get warned about.

I note a few more things.

0a.  Nonsense input (triple vertical lines) are diagnosed.

0b.  Redundant instruction (vlines where box borders already will be) are
diagnosed.

1.  Double vertical lines are not handled well in nroff mode.  Single and
vertical lines between columns are designed to overprint the inter-column
spacing in nroff mode, and this leads to ugly consequences in the last exhibit
above, and uglier ones still if you reduce the column space where vertical
lines are below 3.  I am tempted to withdraw support for double vertical lines
in nroff mode.

2.  In the first table, if we add another character to the last entry and
horizontal line on another row, the table will overrun the line length with no
warning.  This is an aspect of bug #62471.

3.  It might be possible to address that case, and the straggling vertical
line case, by drawing horizontal and vertical lines 1n shorter on nroff
devices if no line intersection will take place.  (Accommodation of that
scenario is why they are drawn too long in the first place.)  My changes to
_tbl_ over the last year or so track more state about `hline` and `vline`
usage, so this may be tractable.

4.  Doublebox tables are terribly ugly in nroff mode (also see bug #43637). 
It might be better to withdraw support for them (in nroff mode only) by
throwing a diagnostic as with double vlines as suggested in item 1 above. 
Double hlines, accessible with '=' table entries, are rendered as single
hlines instead.  Also see bug #43636.

5.  I've added symmetry.  Vertical lines on the leading (left) edge of a
table, and boxed ones, now have a space after them, just as trailing (right)
edges have one before them.







    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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