Subject: bug#46422: 'pr' screws up tabstops in multicolumn outpt?

From: Erik Auerswald <[email-masked]>
Date: Wed, 10 Feb 2021 16:44:14 +0100

Hi,

On Wed, Feb 10, 2021 at 01:42:29PM +0100, Leonard Janis Robert König wrote:
> I'm sorry if I this is not a bug but to be expected, but I thnk pr
> doesn't get the alignment of tabs in multicolumn output right.
> 
> Consider the following test input, where everything from x->x is a tab
> (with tabs 8):

Email quoting disturbs the alignment with tabs, thus I omit those
examples.

> Run it through multicolumn pr, e.g.,
> 
>     pr -t -2 test > out
> 
> The output looks [garbled.]
> [...]
> In contrast, on a SunOS 5.10 machine, I get:
> 
> 123456781234567812345678123456781   123456781234567812345678123456781
>         x       x       x       x           x       x       x       x

This is lacking the first 'x', did you use a different input file?

> Basically, SunOS pr notices, that it cannot print "\tx\tx\tx\tx"
> anymore, since the separation between the pages messed that up.
> Instead it prints "\t     x\t     x\t     x\t     x".

You can work around the issue by using "expand" to change tabs into
spaces before using "pr":

$ expand test | pr -t -2
123456781234567812345678123456781   123456781234567812345678123456781
x	x	x	x	x   x	    x	    x	    x	    x

> [...]
> This seems *kind* of related to multi-column merged
> output, as was discussed some years ago here:
> https://lists.gnu.org/archive/html/bug-coreutils/2007-03/msg00121.html

Just keeping tabs for the second column cannot always work.

> [...]
> What do you think?

It seems to me the approach of "expand"ing the tabs to spaces before using
"pr" is the most general.

Thanks,
Erik
-- 
Be water, my friend.
                        -- Bruce Lee