From 18dff24acc97e70aa3fcb7d989baef18f939ce4d Mon Sep 17 00:00:00 2001 From: k-pop connoisseur Date: Sun, 15 Dec 2024 03:46:28 +0100 Subject: [PATCH 1/2] on session load, restore correct filter function --- src/nnn.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/nnn.c b/src/nnn.c index b1052f9c2..0895caf72 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -4542,7 +4542,9 @@ static bool load_session(const char *sname, char **path, char **lastdir, char ** *path = g_ctx[cfg.curctx].c_path; *lastdir = g_ctx[cfg.curctx].c_last; *lastname = g_ctx[cfg.curctx].c_name; - set_sort_flags('\0'); /* Set correct sort options */ + /* Set correct sort and filter options */ + set_sort_flags('\0'); + filterfn = cfg.regex ? &visible_re : &visible_str; xstrsncpy(curssn, sname ? sname : "@", NAME_MAX); status = TRUE; From a9093c6dd17727ab09c711d29435173818fc44ba Mon Sep 17 00:00:00 2001 From: k-pop connoisseur Date: Sun, 15 Dec 2024 05:24:52 +0100 Subject: [PATCH 2/2] switch filterfn on ctx changes this should fix more crashes related to switching between contexts with different types of filters active. particularly when switching from a regex filtered context to a string filtered one. --- src/nnn.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/nnn.c b/src/nnn.c index 0895caf72..48c248da3 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -4385,6 +4385,7 @@ static void setcfg(settings newcfg) /* Synchronize the global function pointers to match the new cfg. */ entrycmpfn = cfg.reverse ? &reventrycmp : &entrycmp; namecmpfn = cfg.version ? &xstrverscasecmp : &xstricmp; + filterfn = cfg.regex ? &visible_re : &visible_str; } static void savecurctx(char *path, char *curname, int nextctx)