mirror of
https://github.com/jarun/nnn.git
synced 2024-12-01 02:49:44 +00:00
^L at empty prompt shows last filter
This commit is contained in:
parent
bb3d79ce21
commit
aea48508da
38
src/nnn.c
38
src/nnn.c
|
@ -2119,10 +2119,25 @@ static int filterentries(char *path, char *lastname)
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*ch == CONTROL('L') && wln[1]) {
|
if (*ch == CONTROL('L')) {
|
||||||
ln[REGEX_MAX - 1] = ln[1];
|
if (wln[1]) {
|
||||||
wln[1] = '\0';
|
ln[REGEX_MAX - 1] = ln[1];
|
||||||
len = 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
|
} else
|
||||||
wln[--len] = '\0';
|
wln[--len] = '\0';
|
||||||
|
|
||||||
|
@ -2138,21 +2153,6 @@ static int filterentries(char *path, char *lastname)
|
||||||
case KEY_MOUSE: // fallthrough
|
case KEY_MOUSE: // fallthrough
|
||||||
case 27: /* Exit filter mode on Escape */
|
case 27: /* Exit filter mode on Escape */
|
||||||
goto end;
|
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) {
|
if (r == OK) {
|
||||||
|
|
Loading…
Reference in a new issue