]> Sergey Matveev's repositories - nnn.git/commitdiff
Alt+Esc to exit nav-to-type and redraw
authorArun Prakash Jana <engineerarun@gmail.com>
Sun, 12 Jul 2020 18:30:34 +0000 (00:00 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Sun, 12 Jul 2020 18:30:34 +0000 (00:00 +0530)
src/nnn.c

index 84c284ef9e3d9b0a67537bff3e2cbf9a3543b67c..23ef4c0ab9e51117b94ac3a31e264217ff0d6ae4 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -2377,8 +2377,12 @@ static int nextsel(int presel)
                        timeout(0);
                        c = getch();
                        if (c != ERR) {
-                               ungetch(c);
-                               c = ';';
+                               if (c == 27)
+                                       c = CONTROL('L');
+                               else {
+                                       ungetch(c);
+                                       c = ';';
+                               }
                        } else
                                c = 27;
                        settimeout();
@@ -2647,8 +2651,17 @@ static int filterentries(char *path, char *lastname)
 #endif
                case 27: /* Exit filter mode on Escape and Alt+key */
                        if (handle_alt_key(ch) != ERR) {
-                               unget_wch(*ch);
-                               *ch = ';';
+                               if (*ch == 27) { /* Handle Alt + Esc */
+                                       if (wln[1]) {
+                                               ln[REGEX_MAX - 1] = ln[1];
+                                               ln[1] = wln[1] = '\0';
+                                               ndents = total;
+                                               *ch = CONTROL('L');
+                                       }
+                               } else {
+                                       unget_wch(*ch);
+                                       *ch = ';';
+                               }
                        }
                        goto end;
                }