Re: fix for readline terminal size problems when window is resized with open pager

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: fix for readline terminal size problems when window is resized with open pager
Date: 2015-12-14 21:57:22
Message-ID: CAHyXU0w+2Y7CyX0uWJg-cV_m_c1Yjt0ZXnrR0+5KohDsrkpwyw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Dec 14, 2015 at 2:50 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Alvaro Herrera <alvherre(at)2ndquadrant(dot)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 Content-Type Size
psql_readline_fix.patch text/x-patch 2.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Verite 2015-12-14 22:09:40 Re: [patch] Proposal for \rotate in psql
Previous Message Paul Ramsey 2015-12-14 21:04:40 Re: Parallel Aggregate