input: allow also a Meta keystroke to abort a Search command

(Still, this does not allow a full escape sequence to be used as
the Cancel command, but I think that is an acceptable limitation,
because 1) nobody ought to be using --rawsequences, and 2) very
few people will bind Cancel to something like F3 or Ins.)

This improves the fix for https://savannah.gnu.org/bugs/?58825.
This commit is contained in:
Benno Schulenberg 2020-08-20 08:30:11 +02:00
parent 9229834935
commit 8a5449cebe

View File

@ -197,10 +197,16 @@ int findnextstr(const char *needle, bool whole_word_only, int modus,
int input = wgetch(edit);
lastkbcheck = time(NULL);
meta_key = FALSE;
/* Consume all waiting keystrokes until a Cancel. */
while (input != ERR) {
if (input == ESC_CODE) {
napms(20);
input = wgetch(edit);
meta_key = TRUE;
} else
meta_key = FALSE;
if (func_from_key(&input) == do_cancel) {
statusbar(_("Cancelled"));
/* Clear out the key buffer (in case a macro is running). */
@ -209,6 +215,7 @@ int findnextstr(const char *needle, bool whole_word_only, int modus,
enable_waiting();
return -2;
}
input = wgetch(edit);
}