From f1d9c249385f7c1a5e5bef4d83fdb6bc46c90ca9 Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Fri, 24 Mar 2017 05:07:14 +0100 Subject: [PATCH] Do not exit readline prompt early if it's in a subcommand of some sort --- src/curses/window.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/curses/window.cpp b/src/curses/window.cpp index 987f039b..46d2e55f 100644 --- a/src/curses/window.cpp +++ b/src/curses/window.cpp @@ -54,7 +54,10 @@ int read_key(FILE *) x = w->getX(); if (w->runPromptHook(rl_line_buffer, &done)) { - if (done) + // Do not end if readline is in one of its commands, e.g. searching + // through history, as it doesn't actually make readline exit and it + // becomes stuck in a loop. + if (!RL_ISSTATE(RL_STATE_DISPATCHING) && done) { rl_done = 1; return EOF;