src/nnn.c | 13 ++++++++----- diff --git a/src/nnn.c b/src/nnn.c index 0388b23c6ab3786d7e333fc526a2785667d33f39..b3c188da677696afcfe51631e1b0ce5cdb735986 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -4308,6 +4308,9 @@ } tmpcfg.curctx = nextctx; cfg = tmpcfg; + /* Restore the global function pointers alongside the cfg. */ + entrycmpfn = cfg.reverse ? &reventrycmp : &entrycmp; + namecmpfn = cfg.version ? &xstrverscasecmp : &xstricmp; } #ifndef NOSSN @@ -6248,11 +6251,8 @@ cfg.blkorder = 0; r = 'd'; } - if (cfg.version) - namecmpfn = &xstrverscasecmp; - - if (cfg.reverse) - entrycmpfn = &reventrycmp; + entrycmpfn = cfg.reverse ? &reventrycmp : &entrycmp; + namecmpfn = cfg.version ? &xstrverscasecmp : &xstricmp; } else if (r == CONTROL('T')) { /* Cycling order: clear -> size -> time -> clear */ if (cfg.timeorder) @@ -8018,6 +8018,9 @@ lastdir = g_ctx[r].c_last; lastname = g_ctx[r].c_name; cfg = g_ctx[r].c_cfg; + /* Restore the global function pointers alongside the cfg. */ + entrycmpfn = cfg.reverse ? &reventrycmp : &entrycmp; + namecmpfn = cfg.version ? &xstrverscasecmp : &xstricmp; cfg.curctx = r; setdirwatch();