]> Sergey Matveev's repositories - nnn.git/commitdiff
Exit prompt on ^D at empty prompt
authorArun Prakash Jana <engineerarun@gmail.com>
Mon, 27 Jan 2020 14:16:10 +0000 (19:46 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Mon, 27 Jan 2020 14:16:10 +0000 (19:46 +0530)
src/nnn.c

index 5b1c7a8c8aee8e1eb7b2ff0b8d98523f8b39bb1e..6a35f1137084a0e0b6b125fa3a01474c323135aa 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -2412,8 +2412,12 @@ static char *xreadline(const char *prefill, const char *prompt)
                        case CONTROL('D'):
                                if (pos < len)
                                        ++pos;
-                               else
-                                       continue; // fallthrough
+                               else if (!(pos || len)) { /* Exit on ^D at empty prompt */
+                                       len = 0;
+                                       goto END;
+                               } else
+                                       continue;
+                               // fallthrough
                        case 127: // fallthrough
                        case '\b': /* rhel25 sends '\b' for backspace */
                                if (pos > 0) {