nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 8a5449cebe7613d60eae881095a38c8b664cbc4c
parent 9229834935273415d143f3e00eb17cc86201c924
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Thu, 20 Aug 2020 08:30:11 +0200

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.

Diffstat:
Msrc/search.c | 9++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/search.c b/src/search.c @@ -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); }