src/nnn.c | 5 +++-- diff --git a/src/nnn.c b/src/nnn.c index d2c262a59c44f1754a188c1e51049f4b87925833..46e95c5f7964051495089b34eeaa63c7acf7b909 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -2992,7 +2992,7 @@ static int (*filterfn)(const fltrexp_t *fltr, const char *fname) = &visible_str; static void clearfilter(void) { - char *fltr = g_ctx[cfg.curctx].c_fltr; + char * const fltr = g_ctx[cfg.curctx].c_fltr; if (fltr[1]) { fltr[REGEX_MAX - 1] = fltr[1]; @@ -4455,6 +4455,7 @@ if (ctx == '+') /* Get smart context */ ctx = (int)(get_free_ctx() + 1); if (ctx == 0 || ctx == cfg.curctx + 1) { /* Same context */ + clearfilter(); xstrsncpy(*lastdir, *path, PATH_MAX); xstrsncpy(*path, nextpath, PATH_MAX); } else { /* New context */ @@ -7898,9 +7899,9 @@ if (ndents) xstrsncpy(runfile, pdents[cur].name, NAME_MAX); g_state.runctx = cfg.curctx; lastname[0] = '\0'; + clearfilter(); } setdirwatch(); - clearfilter(); if (g_state.runplugin == 1) /* Allow filtering in plugins directory */ presel = FILTER; goto begin;