Hello, The following patch deals with a long standing gripe of mine that the terminal frequently gets garbled so that when typing. I guess this problem is entirely dependent on pager settings and your interaction patterns with the window (in particular, if you tend to resize the window when the pager is open). Experimenting with the problem, it became pretty clear: libreadline for whatever reason does not get the signal from the kernal telling it that the bounds have changed. This problem does not manifest 100% of the time, you may have to get the pager to open, resize the window, close the pager, and recall a previous long line (or type a new one) several times to get the problem to occur. Nevertheless, the attached seems to end the problem.
This adds a dependency to print.c on input.h for the readline macro and the readline header. merlin diff --git a/src/bin/psql/print.c b/src/bin/psql/print.c index 655850b..ede736e 100644 --- a/src/bin/psql/print.c +++ b/src/bin/psql/print.c @@ -27,6 +27,7 @@ #include "common.h" #include "mbprint.h" #include "print.h" +#include "input.h" /* * We define the cancel_pressed flag in this file, rather than common.c where @@ -2247,6 +2248,13 @@ ClosePager(FILE *pagerpipe) #ifndef WIN32 pqsignal(SIGPIPE, SIG_DFL); #endif +#ifdef USE_READLINE + /* + * Force libreadline to recheck the terminal size in case pager may + * have handled any terminal resize events. + */ + rl_resize_terminal(); +#endif } } -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers