Re: Proposed patch - psql wraps at window width

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: "Bruce Momjian" <bruce(at)momjian(dot)us>
Cc: "Alvaro Herrera" <alvherre(at)commandprompt(dot)com>, "Brendan Jurd" <direvus(at)gmail(dot)com>, "PostgreSQL-development" <pgsql-hackers(at)postgresql(dot)org>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Bryce Nesbitt" <bryce2(at)obviously(dot)com>, <heikki(at)enterprisedb(dot)com>
Subject: Re: Proposed patch - psql wraps at window width
Date: 2008-04-26 05:22:48
Message-ID: 87ej8tnqaf.fsf@oxford.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


[Just when I thought I was out, they pull me back in -- argh, I'm weak]

"Bruce Momjian" <bruce(at)momjian(dot)us> writes:

> FYI, ls -C actually wraps to 72(?) unless you specify another width,

I told you exactly what ls did, at least GNU ls. It uses -w if specified, if
not then it uses the ioctl if that succeeds, if it fails it uses COLUMNS, and
if that's unavailable it uses a constant.

> one possible behavior would be for \pset wrapped to wrap to 72 for
> file/pipe unless you set \pset columns.

You can't use ls to justify having different rules for screen width for
"file/pipe":

$ COLUMNS=80 ls -C | cat
distmp3.rh3280 gconfd-stark orbit-stark purpleNMN49T ssh-WdHPsk4277

$ COLUMNS=60 ls -C | cat
distmp3.rh3280 orbit-stark ssh-WdHPsk4277
gconfd-stark purpleNMN49T

$ COLUMNS=40 ls -C | cat
distmp3.rh3280 purpleNMN49T
gconfd-stark ssh-WdHPsk4277
orbit-stark

$ COLUMNS=20 ls -C | cat
distmp3.rh3280
gconfd-stark
orbit-stark
purpleNMN49T
ssh-WdHPsk4277

> That might make the "I want it always to wrap" group happier, but not the
> "wrapped shouldn't affect file/pipe". I have not heard anyone explain why
> the later behavior is bad, especially if we default to a width of 72 rather
> than the screen width.

Presumably they're concerned that scripts which dump out data and then try to
parse it will have trouble parsing wrapped output. In any case that should be
based on whether isatty() is true, which is related to but not the same as
whether the window size ioctl succeeds.

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
Ask me about EnterpriseDB's Slony Replication support!

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2008-04-26 06:13:50 Re: we don't have a bugzilla
Previous Message Raphaël Jacquot 2008-04-26 05:13:27 we don't have a bugzilla