Re: Proposed patch - psql wraps at window width

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Gregory Stark <stark(at)enterprisedb(dot)com>
Cc: Bryce Nesbitt <bryce2(at)obviously(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposed patch - psql wraps at window width
Date: 2008-05-06 14:59:58
Message-ID: 200805061459.m46ExwZ15146@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Gregory Stark wrote:
> "Bruce Momjian" <bruce(at)momjian(dot)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(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Aidan Van Dyk 2008-05-06 15:30:14 Re: Proposed patch - psql wraps at window width
Previous Message Bruce Momjian 2008-05-06 14:55:52 Re: Proposed patch - psql wraps at window width