aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bin/psql/command.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index c562c04afee..0955142215a 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -5145,6 +5145,18 @@ do_watch(PQExpBuffer query_buf, double sleep)
pclose(pagerpipe);
restore_sigpipe_trap();
}
+ else
+ {
+ /*
+ * If the terminal driver echoed "^C", libedit/libreadline might be
+ * confused about the cursor position. Therefore, inject a newline
+ * before the next prompt is displayed. We only do this when not
+ * using a pager, because pagers are expected to restore the screen to
+ * a sane state on exit.
+ */
+ fprintf(stdout, "\n");
+ fflush(stdout);
+ }
#ifdef HAVE_POSIX_DECL_SIGWAIT
/* Disable the interval timer. */