bug-coreutils
[Top][All Lists]
Advanced

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

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


From: Leonard Janis Robert König
Subject: bug#46422: 'pr' screws up tabstops in multicolumn outpt?
Date: Wed, 10 Feb 2021 17:10:23 +0100
User-agent: Evolution 3.38.3 (by Flathub.org)

Hi,

On Wed, 2021-02-10 at 16:44 +0100, Erik Auerswald wrote:
> 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?

Yes, my bad, I toyed around a bit.  The result, with the same input
file, is as I described:

123456781234567812345678123456781   123456781234567812345678123456781
x       x       x       x       x   x       x       x       x       x

> 
> > 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.

But that seems to be what GNU pr tries to do.

> > [...]
> > What do you think?
> 
> It seems to me the approach of "expand"ing the tabs to spaces before
> using
> "pr" is the most general

It is indeed the most general approach, but this would be quite a
caveat for anyone who prints tabbed source code in a multicolumn
format, where the columns do not happen to be starting at n*8
characters.  I could confirm that FreeBSD does mirror the SunOS
behavior as well.

~ leo







reply via email to

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