On Mon, May 26, 2008 at 4:33 AM, James Youngman <[EMAIL PROTECTED]> wrote: [rearranged] > On Mon, May 26, 2008 at 8:37 AM, Philip Ganchev <[EMAIL PROTECTED]> 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.
--- 6.13/ls.1 2008-06-19 00:49:17.000000000 -0400 +++ 6.12/ls.1 2008-06-19 00:19:36.000000000 -0400 @@ -10,8 +10,6 @@ .PP List information about the FILEs (the current directory by default). Sort entries alphabetically if none of \fB\-cftuvSUX\fR nor \fB\-\-sort\fR. -If output is to a terminal, by default ls outputs tabs between file names on -each line of output. .PP Mandatory arguments to long options are mandatory for short options too. .TP @@ -186,9 +184,7 @@ sort by modification time .TP \fB\-T\fR, \fB\-\-tabsize\fR=\fICOLS\fR -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. +assume tab stops at each COLS instead of 8 .TP \fB\-u\fR with \fB\-lt\fR: sort by, and show, access time
_______________________________________________ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils