bugGNU roff - Bugs: bug #49390, last line of boxed tables...

 
 

bug #49390: last line of boxed tables overprinted on nroff devices

Submitter:  Osamu Sayama <sayama>
Submitted:  Thu 20 Oct 2016 03:35:03 AM UTC
   
 
Category:  Preprocessor tbl Severity:  3 - Normal
Item Group:  Incorrect behaviour Status:  Fixed
Privacy:  Public Assigned to:  gbranden
Open/Closed:  Closed Planned Release:  1.23.0
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sun 28 Aug 2022 11:03:03 AM UTC, comment #7: 
Ingo Schwarze <schwarze>
Group Member
Sat 30 Jul 2022 06:56:25 PM UTC, comment #6: 


commit 8818c07cff782fc8a0fec7597cd789bd1a02a20b (HEAD -> master)
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
Date:   Sat Jul 30 11:04:22 2022 -0500

    [tbl]: Fix Savannah #49390.

    * src/preproc/tbl/table.cpp (table::do_bottom): Avoid overprinting a
      boxed table's bottom border on nroff devices.

    Fixes <https://savannah.gnu.org/bugs/?49390>.  Thanks to Osamu Sayama
    for the report.


G. Branden Robinson <gbranden>
Group administrator
Sat 30 Jul 2022 04:01:15 PM UTC, comment #5: 

Here are some exhibits.  The first is a very simple reproducer for the reported problem; the second illustrates that the same problem does not occur when an unboxed table ends with a horizontal rule at the bottom, which one might suspect could happen.


$ cat EXPERIMENTS/sayama-simpler.roff
foo
.TS
box;
L.
bar
.TE
baz
.pl \n(nlu
$ nroff -t -Tascii EXPERIMENTS/sayama-simpler.roff
foo
+----+
|bar |
baz--+
$ cat EXPERIMENTS/sayama-with-rule.roff
foo
.TS
L.
bar
_
.TE
baz
.pl \n(nlu
$ tgu -t -Tascii EXPERIMENTS/sayama-with-rule.roff
foo
bar
----
baz


We also see evidence of bug #62471, which vexes me and appears quite difficult to address.

The fix for this, however, is straightforward.


diff --git a/src/preproc/tbl/table.cpp b/src/preproc/tbl/table.cpp
index 18cee1e92..dcf77b05d 100644
--- a/src/preproc/tbl/table.cpp
+++ b/src/preproc/tbl/table.cpp
@@ -3025,6 +3025,11 @@ void table::do_bottom()
           ".\\}\n");
   if (flags & DOUBLEBOX)
     prints(".sp " DOUBLE_LINE_SEP "\n");
+  // Horizontal box lines take up an entire row on nroff devices (maybe
+  // a half-row if we ever support [emulators of] devices like the
+  // Teletype Model 37 with half-line motions).
+  if (flags & (BOX | DOUBLEBOX | ALLBOX))
+    prints(".if n .sp\n");
   prints("." RESET_MACRO_NAME "\n"
         ".fc\n"
         ".cp \\n(" COMPATIBLE_REG "\n");


G. Branden Robinson <gbranden>
Group administrator
Sat 30 Jul 2022 03:37:08 PM UTC, comment #4: 

I need to clear up some misconceptions about this bug.

comment #2:

>   When this happens, the '.TE' macro does not output the last line in
> the table.
>
>   The '.TE' macro in the packages 'me', 'mom', and 'ms' does output the
> last line (using '.sp ...' or '.br'),
> but not in the 'man' and 'mm' packages.
>
>   The simplest fix is to add '.br' as the last line in the .TE
> macro.
>
>   If the purpose of the macro '.TE' is to really finish the table, it
> should do so.


This explanation is completely incorrect.

1. This bug appears to affect only output to nroff devices.

2. It is not a `TE` macro's job to output the last line, or any other line of the table; it is tbl's.  (One could argue that if `TS` opened a diversion to accept the table content, then it's `TE`'s responsibility to emit that diversion, but it remains tbl's duty to output it--to a diversion or otherwise.)

3. You can observe the overprint of the last line of a boxed table even in a "raw" roff document.

4. The macro packages should not be trying to work around this bug.

5. Simply breaking the line is insufficient.  The vertical position is incorrect and the line is already broken.  Another `br` request is nilpotent.

6. Your "simplest fix" does not work.

7. Again, the `TE` macro should not compensate for anything that tbl can easily accomplish on its own, through separation of concerns.  This is a simple application of the modular design principle.

G. Branden Robinson <gbranden>
Group administrator
Sat 30 Jul 2022 03:31:23 PM UTC, comment #3: 

I have a fix for this.

G. Branden Robinson <gbranden>
Group administrator
Thu 17 Dec 2020 10:05:52 PM UTC, comment #2: 

  When this happens, the '.TE' macro does not output the last line in
the table.

  The '.TE' macro in the packages 'me', 'mom', and 'ms' does output the
last line (using '.sp ...' or '.br'),
but not in the 'man' and 'mm' packages.

  The simplest fix is to add '.br' as the last line in the .TE
macro.

  If the purpose of the macro '.TE' is to really finish the table, it
should do so.

Bjarni Ingi Gislason <bjarniig>
Thu 20 Oct 2016 01:40:12 PM UTC, comment #1: 

I agree that behaviour is unpleasant.

Maintaining the tbl implementation in the mandoc(1) toolbox, this is one of the rare cases where i decided to not follow GNU's lead and instead put the subsequent text on a new line after the table.

I admit i didn't try to write a patch to fix this in GNU roff, though...

Ingo Schwarze <schwarze>
Group Member
Thu 20 Oct 2016 03:35:03 AM UTC, original submission:  

I got the following report.

To reproduce, please try the following with using attached sample file.

% tbl sample.1 | troff -man -Tascii | grotty -c | less -s

I can see the line 'This is a Test' is overlapped, so we are using
to add one extra line after ".TE" to avoid this problem.

Osamu Sayama <sayama>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #38771:  sample.1 added by sayama (136B - application/octet-stream)

 

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 schwarze (Posted a comment)
  • -email is unavailable- added by sayama (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.

     

    Follow 11 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-07-30 gbranden StatusIn Progress Fixed
        Open/ClosedOpen Closed
        Planned ReleaseNone 1.23.0
    2022-07-30 gbranden Severity2 - Minor 3 - Normal
        StatusConfirmed In Progress
        Assigned toNone gbranden
        SummaryLast line of man page table overlapped last line of boxed tables overprinted on nroff devices
    2018-02-16 schwarze CategoryNone Preprocessor tbl
        Severity3 - Normal 2 - Minor
        StatusNone Confirmed
    2016-10-20 sayama Attached File- Added sample.1, #38771

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code