diff options
| author | 2017-04-08 11:14:51 +0530 | |
|---|---|---|
| committer | 2017-04-08 11:14:51 +0530 | |
| commit | 5aa4c799c0b64eb0959306205e1373f684527772 (patch) | |
| tree | 8f29d8f8e61a09e7412bc03d8b20347c475a7155 | |
| parent | 1293b28f2d768ff673b0fbbc551750223c2ab7bb (diff) | |
| download | nnn-5aa4c799c0b64eb0959306205e1373f684527772.tar.gz | |
Remove redundant search when entering directory
| -rw-r--r-- | nnn.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -1065,13 +1065,18 @@ browse(char *ipath, char *ifilter) struct stat sb; regex_t re; int r, fd; + enum action sel = SEL_RUNARG + 1; xstrlcpy(path, ipath, sizeof(path)); xstrlcpy(fltr, ifilter, sizeof(fltr)); oldpath[0] = '\0'; newpath[0] = '\0'; 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) { printwarn(); goto nochange; @@ -1080,7 +1085,8 @@ begin: for (;;) { redraw(path); nochange: - switch (nextsel(&run, &env)) { + sel = nextsel(&run, &env); + switch (sel) { case SEL_QUIT: dentfree(dents); return; |