]> Sergey Matveev's repositories - nnn.git/commitdiff
Fix KEY_RESIZE loop
authorArun Prakash Jana <engineerarun@gmail.com>
Thu, 24 Oct 2019 03:17:45 +0000 (08:47 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Thu, 24 Oct 2019 03:17:45 +0000 (08:47 +0530)
src/nnn.c

index 9b9b6dad20e6af294e18ac570d10b6de412ca375..70c945e0be9034ad65e363d14687faf61e0b15f6 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -588,22 +588,20 @@ static void printprompt(const char *str)
 
 static int get_input(const char *prompt)
 {
-       int r;
+       int r = KEY_RESIZE;
 
        if (prompt)
                printprompt(prompt);
        cleartimeout();
 #ifdef KEY_RESIZE
-       do {
+       while (r == KEY_RESIZE) {
                r = getch();
-               if (r == KEY_RESIZE) {
-                       if (prompt) {
-                               clearoldprompt();
-                               xlines = LINES;
-                               printprompt(prompt);
-                       }
+               if (r == KEY_RESIZE && prompt) {
+                       clearoldprompt();
+                       xlines = LINES;
+                       printprompt(prompt);
                }
-       } while (r == KEY_RESIZE);
+       };
 #else
        r = getch();
 #endif