aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xconfigure3
-rw-r--r--configure.in2
-rw-r--r--src/bin/psql/input.c12
-rw-r--r--src/include/pg_config.h.in3
4 files changed, 18 insertions, 2 deletions
diff --git a/configure b/configure
index c8512e89fb7..11ee392ac6e 100755
--- a/configure
+++ b/configure
@@ -22698,7 +22698,8 @@ _ACEOF
fi
-for ac_func in rl_completion_matches rl_filename_completion_function
+
+for ac_func in rl_completion_matches rl_filename_completion_function rl_reset_screen_size
do
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
diff --git a/configure.in b/configure.in
index 40f496ad616..4f8af48267e 100644
--- a/configure.in
+++ b/configure.in
@@ -1493,7 +1493,7 @@ LIBS="$LIBS_including_readline"
if test "$with_readline" = yes; then
PGAC_VAR_RL_COMPLETION_APPEND_CHARACTER
- AC_CHECK_FUNCS([rl_completion_matches rl_filename_completion_function])
+ AC_CHECK_FUNCS([rl_completion_matches rl_filename_completion_function rl_reset_screen_size])
AC_CHECK_FUNCS([append_history history_truncate_file])
fi
diff --git a/src/bin/psql/input.c b/src/bin/psql/input.c
index d56f37fb9ac..14ac034b576 100644
--- a/src/bin/psql/input.c
+++ b/src/bin/psql/input.c
@@ -70,6 +70,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;
@@ -335,6 +346,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 c09e0ed021e..1843be9fd26 100644
--- a/src/include/pg_config.h.in
+++ b/src/include/pg_config.h.in
@@ -427,6 +427,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 `scandir' function. */
#undef HAVE_SCANDIR