]> Sergey Matveev's repositories - nnn.git/commitdiff
Fix issues with DEL on Mac on empty regex exprn
authorArun Prakash Jana <engineerarun@gmail.com>
Sun, 4 Jun 2017 18:28:30 +0000 (23:58 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Sun, 4 Jun 2017 18:28:30 +0000 (23:58 +0530)
On Mac and error is thrown if the regex expression to regcomp() is empty.

Please refer to comments at:
https://github.com/jarun/nnn/commit/c42df81ae5f1206ee586d4e2f236c77f1f0dfbbe

nnn.c

diff --git a/nnn.c b/nnn.c
index 78a817f979d7d6cba586b31794610b4f5c2a7f75..c73dcaa716f02682c4e7f39a810311b3b7979bd3 100644 (file)
--- a/nnn.c
+++ b/nnn.c
@@ -475,7 +475,7 @@ setfilter(regex_t *regex, char *filter)
        static int r;
 
        r = regcomp(regex, filter, REG_NOSUB | REG_EXTENDED | REG_ICASE);
-       if (r != 0) {
+       if (r != 0 && filter && filter[0] != '\0') {
                len = COLS;
                if (len > LINE_MAX)
                        len = LINE_MAX;
@@ -738,8 +738,10 @@ readln(char *path)
                                wln[--len] = '\0';
                                wcstombs(ln, wln, LINE_MAX << 2);
                                ndents = total;
-                               if (matches(pln) == -1)
+                               if (matches(pln) == -1) {
+                                       printprompt(ln);
                                        continue;
+                               }
                                redraw(path);
                                printprompt(ln);
                                break;