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;