mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 20:01:27 +00:00
Remove redundant search when entering directory
This commit is contained in:
parent
1293b28f2d
commit
5aa4c799c0
10
nnn.c
10
nnn.c
|
@ -1065,13 +1065,18 @@ browse(char *ipath, char *ifilter)
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
regex_t re;
|
regex_t re;
|
||||||
int r, fd;
|
int r, fd;
|
||||||
|
enum action sel = SEL_RUNARG + 1;
|
||||||
|
|
||||||
xstrlcpy(path, ipath, sizeof(path));
|
xstrlcpy(path, ipath, sizeof(path));
|
||||||
xstrlcpy(fltr, ifilter, sizeof(fltr));
|
xstrlcpy(fltr, ifilter, sizeof(fltr));
|
||||||
oldpath[0] = '\0';
|
oldpath[0] = '\0';
|
||||||
newpath[0] = '\0';
|
newpath[0] = '\0';
|
||||||
begin:
|
begin:
|
||||||
r = populate(path, oldpath, fltr);
|
|
||||||
|
if (sel == SEL_GOIN && S_ISDIR(sb.st_mode))
|
||||||
|
r = populate(path, NULL, fltr);
|
||||||
|
else
|
||||||
|
r = populate(path, oldpath, fltr);
|
||||||
if (r == -1) {
|
if (r == -1) {
|
||||||
printwarn();
|
printwarn();
|
||||||
goto nochange;
|
goto nochange;
|
||||||
|
@ -1080,7 +1085,8 @@ begin:
|
||||||
for (;;) {
|
for (;;) {
|
||||||
redraw(path);
|
redraw(path);
|
||||||
nochange:
|
nochange:
|
||||||
switch (nextsel(&run, &env)) {
|
sel = nextsel(&run, &env);
|
||||||
|
switch (sel) {
|
||||||
case SEL_QUIT:
|
case SEL_QUIT:
|
||||||
dentfree(dents);
|
dentfree(dents);
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue