static int (*filterfn)(const fltrexp_t *fltr, const char *fname) = &visible_str;
+static void clearfilter()
+{
+ if (g_ctx[cfg.curctx].c_fltr[1])
+ g_ctx[cfg.curctx].c_fltr[1] = 0;
+}
+
static int entrycmp(const void *va, const void *vb)
{
const struct entry *pa = (pEntry)va;
c = getch();
//DPRINTF_D(c);
+ /* Clear previous filter when manually starting */
+ if (c == FILTER)
+ clearfilter();
+
if (presel == MSGWAIT) {
if (cfg.filtermode)
c = FILTER;
/* Save history */
xstrlcpy(lastname, xbasename(path), NAME_MAX + 1);
- g_ctx[cfg.curctx].c_fltr[1] = '\0';
+ clearfilter();
xstrlcpy(path, dir, PATH_MAX);
/* Toggle filter mode on left click on last 2 lines */
if (event.y >= xlines - 2 && event.bstate == BUTTON1_PRESSED) {
- g_ctx[cfg.curctx].c_fltr[1] = '\0';
+ clearfilter();
cfg.filtermode ^= 1;
if (cfg.filtermode) {
presel = FILTER;
xstrlcpy(lastdir, path, PATH_MAX);
xstrlcpy(path, newpath, PATH_MAX);
- lastname[0] = g_ctx[cfg.curctx].c_fltr[1] = '\0';
+ lastname[0] = '\0';
+ clearfilter();
setdirwatch();
goto begin;
case S_IFREG:
if (runfile[0])
runfile[0] = '\0';
- g_ctx[cfg.curctx].c_fltr[1] = '\0';
+ clearfilter();
setdirwatch();
goto begin;
xstrlcpy(lastdir, path, PATH_MAX);
xstrlcpy(path, newpath, PATH_MAX);
- lastname[0] = g_ctx[cfg.curctx].c_fltr[1] = '\0';
+ lastname[0] = '\0';
+ clearfilter();
DPRINTF_S(path);
setdirwatch();
goto begin;
if (strcmp(path, newpath) == 0)
break;
- lastname[0] = g_ctx[cfg.curctx].c_fltr[1] = '\0';
+ lastname[0] = '\0';
+ clearfilter();
/* Save last working directory */
xstrlcpy(lastdir, path, PATH_MAX);
cfg.filtermode ^= 1;
if (cfg.filtermode) {
presel = FILTER;
+ clearfilter();
goto nochange;
}
lastname[0] = '\0';
}
setdirwatch();
- g_ctx[cfg.curctx].c_fltr[1] = 0;
+ clearfilter();
goto begin;
case SEL_LAUNCH:
launch_app(path, newpath);