Skip site navigation (1) Skip section navigation (2)

Re: Proposed patch - psql wraps at window width

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: "Peter Eisentraut" <peter_e(at)gmx(dot)net>
Cc: <pgsql-patches(at)postgresql(dot)org>, "Bruce Momjian" <bruce(at)momjian(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-18 00:42:26
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackerspgsql-patches
"Peter Eisentraut" <peter_e(at)gmx(dot)net> writes:

> Bruce Momjian wrote:
>> I checked the use of COLUMNS and it seems bash updates the environment
>> variable when a window is resized.  I added ioctl(TIOCGWINSZ) if COLUMNS
>> isn't set.  We already had a call in print.c for detecting the
>> number of rows on the screen to determine if the pager should
>> be used.  Seems COLUMNS should take precedence over ioctl(), right?
> Considering that the code to determine the row count is undisputed so far, the 
> column count detection should work the same.  That is, we might not need to 
> look at COLUMNS at all.  Unless there is a use case for overriding the column 
> count (instead of just turning off the wrapping).

I do that all the time. I normally am running under an emacs terminal so I
don't know what width the ioctl's going to get back but it's unlikely to be
right. In any case I may want to format the output to a width narrower than
the window because I'm going to narrow it.

Also, how would you suggest figuring the width to use for output going to a
file? ioctl is irrelevant in that case, imho it should just default to 80
columns if COLUMNS is unset.

  Gregory Stark
  Ask me about EnterpriseDB's Slony Replication support!

In response to


pgsql-hackers by date

Next:From: Tom LaneDate: 2008-04-18 00:47:12
Subject: Re: Lessons from commit fest
Previous:From: Decibel!Date: 2008-04-18 00:28:51
Subject: Re: Cross-field statistics

pgsql-patches by date

Next:From: Tom LaneDate: 2008-04-18 00:49:22
Subject: Re: Proposed patch - psql wraps at window width
Previous:From: Alvaro HerreraDate: 2008-04-17 21:38:51
Subject: Re: datum passed to macro which expects a pointer

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group