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

From Tom Lane
Subject Re: fix for readline terminal size problems when window is resized with open pager
Date
Msg-id 20004.1450282913@sss.pgh.pa.us
Whole thread Raw
In response to Re: fix for readline terminal size problems when window is resized with open pager  (Andreas Karlsson <andreas@proxel.se>)
Responses Re: fix for readline terminal size problems when window is resized with open pager  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
Andreas Karlsson <andreas@proxel.se> writes:
> Did you manage to figure out why one was better than the other? The 
> differences between the functions seem rather subtle.

I'm a bit suspicious of Merlin's recommendation as well.  Looking at
the readline 6.3 sources, it is rl_resize_terminal() not the other
one that is called when an actual SIGWINCH is handled.

Another issue is that rl_reset_screen_size() doesn't exist in older copies
of readline (I don't see it in 4.0 nor 4.2a, which is what I've got laying
around in my archives).  So even if we agree that that's the one to use
when available, we'd need configure logic to fall back to
rl_resize_terminal() otherwise.

> rl_resize_terminal()
> Respects COLUMNS and ROWS and also has some logic when echo mode is 
> turned on which I have not managed to understand yet.

It looks to me like what it's doing is repainting the current line
on the theory that it might be messed up.  Since we are, at this
point, presumably *not* in the middle of accepting a command line,
that should be unnecessary but also harmless.  If there is any
visible difference in behavior, I should think it would be
rl_resize_terminal() that produces more consistent results, because
it does have the repaint logic which the other lacks.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: Performance improvement for joins where outer side is unique
Next
From: Andres Freund
Date:
Subject: Re: fix for readline terminal size problems when window is resized with open pager