]> Sergey Matveev's repositories - nnn.git/commitdiff
Simplify get_input()
authorArun Prakash Jana <engineerarun@gmail.com>
Sun, 31 May 2020 14:40:11 +0000 (20:10 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Sun, 31 May 2020 14:40:11 +0000 (20:10 +0530)
src/nnn.c

index 98f6d2ac081963ee0188f60bef5cb464177497fa..de172e2775b6992f7740923bc681b2d1ea51a318 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -822,22 +822,22 @@ static inline bool xconfirm(int c)
 
 static int get_input(const char *prompt)
 {
-       int r;
-
        if (prompt)
                printmsg(prompt);
        cleartimeout();
+
+       int r = getch();
+
 #ifdef KEY_RESIZE
-       do {
-               r = getch();
-               if (r == KEY_RESIZE && prompt) {
+       while (r == KEY_RESIZE) {
+               if (prompt) {
                        clearoldprompt();
                        xlines = LINES;
                        printmsg(prompt);
                }
-       } while (r == KEY_RESIZE);
-#else
-       r = getch();
+
+               r = getch();
+       }
 #endif
        settimeout();
        return r;