From a75021c2d2ba1f23a110c5bfd795ef74e324e321 Mon Sep 17 00:00:00 2001
From: lostd <lostd@2f30.org>
Date: Fri, 10 Oct 2014 09:50:46 +0300
Subject: [PATCH] Reset to initial filter on directory change

---
 noice.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/noice.c b/noice.c
index 2760e77f..1ac32797 100644
--- a/noice.c
+++ b/noice.c
@@ -450,6 +450,8 @@ nochange:
 				strlcpy(tmp, dir, strlen(dir) + 1);
 				free(path);
 				path = tmp;
+				free(filter);
+				filter = strdup(ifilter); /* Reset filter */
 				goto out;
 			}
 		}
@@ -490,6 +492,8 @@ nochange:
 			if (S_ISDIR(sb.st_mode)) {
 				free(path);
 				path = pathnew;
+				free(filter);
+				filter = strdup(ifilter); /* Reset filter */
 				goto out;
 			}
 			/* Regular file */
@@ -538,6 +542,7 @@ nochange:
 				printmsg("");
 				goto nochange;
 			}
+			free(filter);
 			filter = tmp;
 			filter_re = re;
 			DPRINTF_S(filter);
-- 
2.51.0