Re: Proposed patch - psql wraps at window width

From: Bryce Nesbitt <bryce2(at)obviously(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-patches(at)postgresql(dot)org
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, heikki(at)enterprisedb(dot)com
Subject: Re: Proposed patch - psql wraps at window width
Date: 2008-04-18 04:11:12
Message-ID: 48081F60.8070704@obviously.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<br>
<br>
Peter Eisentraut wrote:
<blockquote cite="mid:200804171509(dot)25472(dot)peter_e(at)gmx(dot)net" type="cite">
<pre wrap="">Bruce Momjian wrote:
</pre>
<blockquote type="cite">
<pre wrap="">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?
</pre>
</blockquote>
<pre wrap=""><!---->
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).
</pre>
</blockquote>
I asked the folks over at "Experts Exchange" to test the behavior of
the ioctl and $COLUMNS on various platforms.  I'd been told that I
would face huge problems if a console was resized.  But the results
were pretty consistent, and nothing had problems with resize: 
<a class="moz-txt-link-freetext" href="http://www.experts-exchange.com/Programming/Open_Source/Q_23243646.html">http://www.experts-exchange.com/Programming/Open_Source/Q_23243646.html</a><br>
<br>
It appears impossible to override $COLUMNS, on some platforms as the
readline call sets it.<br>
On many platforms $COLUMNS is null until the call to readline.<br>
OSX does not set $COLUMNS at all.<br>
<br>
                         -Bryce<br>
<br>
</body>
</html>

Attachment Content-Type Size
unknown_filename text/html 1.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bryce Nesbitt 2008-04-18 04:14:58 Re: Proposed patch - psql wraps at window width
Previous Message Bryce Nesbitt 2008-04-18 03:55:52 Re: Proposed patch - psql wraps at window width

Browse pgsql-patches by date

  From Date Subject
Next Message Bryce Nesbitt 2008-04-18 04:14:58 Re: Proposed patch - psql wraps at window width
Previous Message Bryce Nesbitt 2008-04-18 03:55:52 Re: Proposed patch - psql wraps at window width