Re: fix for readline terminal size problems when window is resized with open pager - Mailing list pgsql-hackers

From Merlin Moncure
Subject Re: fix for readline terminal size problems when window is resized with open pager
Date
Msg-id CAHyXU0w+2Y7CyX0uWJg-cV_m_c1Yjt0ZXnrR0+5KohDsrkpwyw@mail.gmail.com
Whole thread Raw
In response to Re: fix for readline terminal size problems when window is resized with open pager  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: fix for readline terminal size problems when window is resized with open pager  (Andreas Karlsson <andreas@proxel.se>)
Re: fix for readline terminal size problems when window is resized with open pager  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
On Mon, Dec 14, 2015 at 2:50 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Alvaro Herrera <alvherre@2ndquadrant.com> writes:
>> Tom Lane wrote:
>>> Quick followup: rl_resize_terminal() exists in GNU readline at least as
>>> far back as 4.0 (released Feb 1999).  However, it doesn't seem to be there
>>> at all in libedit; I don't see it in OS X Yosemite's headers, anyway.
>>> So we'd need a configure test for this.
>
>> In libedit (NetBSD's at least) there is el_resize() which seems to do
>> the same thing.
>
> Hmm.  I see this in OS X's histedit.h:
>
> void                el_resize(EditLine *);
>
> but it appears that this is part of a completely separate API with
> essentially nothing in common with GNU readline.  Not sure if we have
> the motivation to try to support that API in parallel with readline's.
> I sure don't.

This may be moot; some testing demonstrated that libedit was not
impacted so it really comes down to having the right readline api call
available.  Looking at the code ISTM that libedit resets the terminal
on every prompt.

Also, after some experimentation I had better luck with
rl_reset_screen_size() (vs rl_resize_terminal()) that seemed to give
more regular behavior with the prompt.  So the consolidated patch with
the configure check is attached.

I'll leave it to the powers that be in terms of how and when to apply
this.  My gut is that it could probably be patched in now but I'd feel
comfortable with more testing then my own perfunctory probing.

merlin

Attachment

pgsql-hackers by date:

Previous
From: Paul Ramsey
Date:
Subject: Re: Parallel Aggregate
Next
From: "Daniel Verite"
Date:
Subject: Re: [patch] Proposal for \rotate in psql