aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-01-30 19:19:14 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-01-30 19:19:14 +0530
commit81318f9218adaeae3044d1d93ee4700cb056752d (patch)
tree4ab89b10fb0968e786e365cd36f0628be27ed275
parentf3578247eb72b4852f959fd2f1404219d58efb16 (diff)
downloadnnn-81318f9218adaeae3044d1d93ee4700cb056752d.tar.gz
Remove dir watch before filtering contents
-rw-r--r--src/nnn.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/src/nnn.c b/src/nnn.c
index 309d7ef..7e3c939 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -1249,21 +1249,8 @@ static int nextsel(int *presel)
if (c == 0) {
c = getch();
DPRINTF_D(c);
- } else {
- /* Unwatch dir if we are still in a filtered view */
-#ifdef LINUX_INOTIFY
- if (*presel == FILTER && inotify_wd >= 0) {
- inotify_rm_watch(inotify_fd, inotify_wd);
- inotify_wd = -1;
- }
-#elif defined(BSD_KQUEUE)
- if (*presel == FILTER && event_fd >= 0) {
- close(event_fd);
- event_fd = -1;
- }
-#endif
+ } else
*presel = 0;
- }
if (c == -1) {
++idle;
@@ -3144,6 +3131,18 @@ nochange:
printmsg(mark);
goto nochange;
case SEL_FLTR:
+ /* Unwatch dir if we are still in a filtered view */
+#ifdef LINUX_INOTIFY
+ if (inotify_wd >= 0) {
+ inotify_rm_watch(inotify_fd, inotify_wd);
+ inotify_wd = -1;
+ }
+#elif defined(BSD_KQUEUE)
+ if (event_fd >= 0) {
+ close(event_fd);
+ event_fd = -1;
+ }
+#endif
presel = filterentries(path);
/* Save current */
if (ndents)