correct escape key
authorLaurent MAZET <laurent.mazet@thalesgroup.com>
Wed, 15 May 2024 12:10:34 +0000 (14:10 +0200)
committerLaurent MAZET <laurent.mazet@thalesgroup.com>
Wed, 15 May 2024 12:10:34 +0000 (14:10 +0200)
cmore.c

diff --git a/cmore.c b/cmore.c
index ccf61589c77adc7600d1787a5af1b86b688a2870..8768627e0898fc0dd37e16335d00069d4b4570f7 100644 (file)
--- a/cmore.c
+++ b/cmore.c
@@ -76,12 +76,8 @@ void display (char **lines, int xmax, int ymax, int keep_skip)
         int key = waitforkey ();
         VERBOSE (DEBUG, fprintf (stdout, "key pressed: 0x%04x (%c)\n", key, (key >= ' ') && (key < 256) ? key : '.'));
         switch (key) {
-        case KEY_ESC:
         case ':':
-#ifndef __PDCURSES__
-            key = waitforkey ();
-            switch (key) {
-            case KEY_ESC:
+            switch (waitforkey ()) {
             case ':':
                 DoExit ();
                 /* fallthrough */
@@ -91,7 +87,13 @@ void display (char **lines, int xmax, int ymax, int keep_skip)
                 break;
             }
             break;
-#endif
+        case KEY_ESC:
+#ifndef __PDCURSES__
+            if (waitforkey () != KEY_ESC) {
+                break;
+            }
+            /* fallthrough */
+#endif /* __PDCURSES__ */
         case 'q':
             DoExit ();
             stop = 1;