From 707c8cd57ccb5d1a5fd06969c0c2e5521c49539a Mon Sep 17 00:00:00 2001 From: Thomas Koutcher Date: Wed, 11 Jan 2023 21:49:27 +0100 Subject: [PATCH] Fix readline echo when stdin is redirected Fixes #1229 --- src/display.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/display.c b/src/display.c index 6e754f5bf..168cdbc17 100644 --- a/src/display.c +++ b/src/display.c @@ -21,6 +21,10 @@ #include "tig/display.h" #include "tig/watch.h" +#ifdef HAVE_READLINE +#include +#endif /* HAVE_READLINE */ + #define MAX_KEYS 2000 static void set_terminal_modes(void); @@ -608,6 +612,9 @@ init_tty(void) if (!opt_tty.file) die("Failed to open tty for input"); opt_tty.fd = fileno(opt_tty.file); +#ifdef HAVE_READLINE + rl_instream = opt_tty.file; +#endif /* HAVE_READLINE */ /* attributes */ opt_tty.attr = calloc(1, sizeof(struct termios));