aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2020-01-12 03:36:08 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2020-01-12 03:36:08 +0530
commitaea48508da7ad5ab990094caf93397c81019edbb (patch)
treee32dca3486a9b9869647d6dc0885acc23a4a8bb5 /src
parentbb3d79ce216b42cd71223860a0323c6afdd39d99 (diff)
downloadnnn-aea48508da7ad5ab990094caf93397c81019edbb.tar.gz
^L at empty prompt shows last filter
Diffstat (limited to 'src')
-rw-r--r--src/nnn.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/nnn.c b/src/nnn.c
index 5029c80..81e6929 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -2119,10 +2119,25 @@ static int filterentries(char *path, char *lastname)
goto end;
}
- if (*ch == CONTROL('L') && wln[1]) {
- ln[REGEX_MAX - 1] = ln[1];
- wln[1] = '\0';
- len = 1;
+ if (*ch == CONTROL('L')) {
+ if (wln[1]) {
+ ln[REGEX_MAX - 1] = ln[1];
+ wln[1] = '\0';
+ len = 1;
+ } else if (ln[REGEX_MAX - 1]) { /* Show the previous filter */
+ ln[1] = ln[REGEX_MAX - 1];
+ ln[REGEX_MAX - 1] = '\0';
+ len = mbstowcs(wln, ln, REGEX_MAX);
+ /* Go to the top, we don't know if the
+ hovered file will match the filter */
+ cur = 0;
+
+ if (matches(pln) != -1)
+ redraw(path);
+
+ showfilter(ln);
+ continue;
+ }
} else
wln[--len] = '\0';
@@ -2138,21 +2153,6 @@ static int filterentries(char *path, char *lastname)
case KEY_MOUSE: // fallthrough
case 27: /* Exit filter mode on Escape */
goto end;
- case KEY_UP: /* On the first Up, apply previous filter */
- if (len == 1 && ln[REGEX_MAX - 1]) {
- ln[1] = ln[REGEX_MAX - 1];
- ln[REGEX_MAX - 1] = '\0';
- len = mbstowcs(wln, ln, REGEX_MAX);
- /* Go to the top, we don't know if the
- hovered file will match the filter */
- cur = 0;
-
- if (matches(pln) != -1)
- redraw(path);
-
- showfilter(ln);
- continue;
- }
}
if (r == OK) {