diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/psql/input.c | 12 | ||||
-rw-r--r-- | src/include/pg_config.h.in | 3 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/bin/psql/input.c b/src/bin/psql/input.c index e3771040072..c0c5524af53 100644 --- a/src/bin/psql/input.c +++ b/src/bin/psql/input.c @@ -65,6 +65,17 @@ gets_interactive(const char *prompt) { char *result; + /* + * Some versions of readline don't notice SIGWINCH signals that arrive + * when not actively reading input. The simplest fix is to always + * re-read the terminal size. This leaves a window for SIGWINCH to be + * missed between here and where readline() enables libreadline's + * signal handler, but that's probably short enough to be ignored. + */ +#ifdef HAVE_RL_RESET_SCREEN_SIZE + rl_reset_screen_size(); +#endif + /* Enable SIGINT to longjmp to sigint_interrupt_jmp */ sigint_interrupt_enabled = true; @@ -330,6 +341,7 @@ initializeInput(int flags) char home[MAXPGPATH]; useReadline = true; + rl_initialize(); initialize_readline(); useHistory = true; diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in index a20e0cd1d66..16a272efdee 100644 --- a/src/include/pg_config.h.in +++ b/src/include/pg_config.h.in @@ -428,6 +428,9 @@ /* Define to 1 if you have the `rl_filename_completion_function' function. */ #undef HAVE_RL_FILENAME_COMPLETION_FUNCTION +/* Define to 1 if you have the `rl_reset_screen_size' function. */ +#undef HAVE_RL_RESET_SCREEN_SIZE + /* Define to 1 if you have the <security/pam_appl.h> header file. */ #undef HAVE_SECURITY_PAM_APPL_H |