bug-coreutils
[Top][All Lists]
Advanced

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

Re: [coreutils] Bug: ls --tabsize=4


From: Philip Ganchev
Subject: Re: [coreutils] Bug: ls --tabsize=4
Date: Thu, 19 Jun 2008 00:58:19 -0400

On Mon, May 26, 2008 at 4:33 AM, James Youngman <address@hidden> wrote:
[rearranged]
> On Mon, May 26, 2008 at 8:37 AM, Philip Ganchev <address@hidden> wrote:
>> So I think the manual ought to mention that ls outputs tab characters,
>> that those tab characters may be displayed at various tab widths by
>> the terminal (or terminal emulator), and that therefore ls needs to
>> know where the tab stops are in the terminal.

A patch file with the suggested text is attached. The option description reads:

-T --tabsize=COLS
        assume tab stops at each COLS instead of 8 positions.  That
is, the terminal renders tab characters so that they end at each COLS
positions.

And the Description section includes:

If output is to a terminal, by default ls outputs tabs between file
names on each line of output.

I am trying to understand the current design and its rationale.  Sorry
if my ignorant questions are annoying.

Why does ls need the tab stop positions - to output newlines so that
no file name is wrapped on two lines?  Isn't there a way to tell the
terminal not to break a string when wrapping?

>  Tab sizes are a property of the terminal, about which one informs the
> system in order to make text output appear correct.

Can't ls obtain the tab stop positions automatically (from the
terminal?), without needing the user to supply it?

>> Why does ls produce tab characters instead of spaces?
>
> I don't know.   But the documentation does explain how to turn that off.

Sorry, I meant produce spaces to *tabulate* the output.  That involves
counting how many spaces need to be printed between items so that
items on different lines align in the same columns.  I don't see how
to do that from the manual.

[...]
>>  And, she may prefer different tab sizes for different programs.
>
> IMHO then she is doomed to a certain background level of frustration.
>  Tab sizes are a property of the terminal, about which one informs the
> system in order to make text output appear correct.   Trying to do
> that whole thing backwards (i.e. telling different programs different
> things about the properties of the terminal they all use) is likely
> not to work optimally.

If every program tabulated using spaces instead of tabs, then one
parameter *inside the program* would be enough to change the
appearance of the output.  And the output would look correct in any
terminal.  The formatting could be done by a library which every
program could use.

Attachment: ls.1.patch
Description: Text Data


reply via email to

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