From d4304ca88c5b8e3810f4e23c49dc48614922a13d Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Fri, 13 Apr 2018 20:02:28 +0200 Subject: [PATCH] search: use a better value to mean "nothing was typed" When the keyboard buffer is empty, return a value that is not equivalent to , so that typing a bunch of these while searching is going on will not result in some of them getting executed afterward. --- src/search.c | 2 +- src/winio.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/search.c b/src/search.c index e86b20b8..5edeb022 100644 --- a/src/search.c +++ b/src/search.c @@ -219,7 +219,7 @@ int findnextstr(const char *needle, bool whole_word_only, int modus, lastkbcheck = time(NULL); /* Consume all waiting keystrokes until a Cancel. */ - while (input) { + while (input != ERR) { if (func_from_key(&input) == do_cancel) { statusbar(_("Cancelled")); enable_waiting(); diff --git a/src/winio.c b/src/winio.c index b1488d5b..7e338757 100644 --- a/src/winio.c +++ b/src/winio.c @@ -363,7 +363,7 @@ int parse_kbinput(WINDOW *win) kbinput = get_input(win, 1); if (kbinput == NULL && !waiting_mode) - return 0; + return ERR; while (kbinput == NULL) kbinput = get_input(win, 1);