Re: Proposed patch - psql wraps at window width - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Proposed patch - psql wraps at window width
Date
Msg-id 200805061459.m46ExwZ15146@momjian.us
Whole thread Raw
In response to Re: Proposed patch - psql wraps at window width  (Gregory Stark <stark@enterprisedb.com>)
List pgsql-hackers
Gregory Stark wrote:
> "Bruce Momjian" <bruce@momjian.us> writes:
> 
> > FYI, I looked into 'ls -C' hanlding a little more and ls (GNU coreutils)
> > 5.97 honors COLUMNS _only_ in file/pipe output, not for screen output. 
> > What the C code does is to read COLUMNS, then overwrite that value with
> > ioctl() if it works.
> 
> Well saying "file/pipe" and "screen output" is making a lot of assumptions.
> The pipe may still be ending up on the screen if it's being piped to a pager.
> And a "file" could still be a terminal. Also, not all terminals support the
> ioctl().

True, but I can't think of a cleaner way to specify it, and I haven't
see wording that is clearer.  I think most people understand this
distinction.  If they don't they will learn soon enough when they try it.

> What ls does is use the same logic for all cases. When the ioctl works that
> takes precedence regardless of whether it's "file/pipe" or "screen output".
> When it fails it uses COLUMNS instead if set.
> 
> We really must stop thinking in terms of specific use cases. You will tie
> yourselves in knots if you try to enumerate all the types of terminals, places
> people redirect output, and uses people might make for the output. And it will
> result in very complex, hard to explain behaviour which will surprise and
> disappoint users.

I think we need to focus on usability.  Using consistent logic is nice,
but if it doesn't do what most people would want, then we have to adjust.

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com
 + If your life is a hard drive, Christ can be your backup. +


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Proposed patch - psql wraps at window width
Next
From: Aidan Van Dyk
Date:
Subject: Re: Proposed patch - psql wraps at window width