]> Sergey Matveev's repositories - nnn.git/commitdiff
More checks
authorArun Prakash Jana <engineerarun@gmail.com>
Thu, 9 Sep 2021 17:47:22 +0000 (23:17 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Thu, 9 Sep 2021 17:47:22 +0000 (23:17 +0530)
src/nnn.c

index 88a9ab9f06da74b13945443aaca97dc5bec85148..44f297f475b0fa9fa69351453ae465e3410ffdbe 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -4198,8 +4198,10 @@ static void savecurctx(char *path, char *curname, int nextctx)
        if (ctxr->c_cfg.ctxactive) { /* Switch to saved context */
                tmpcfg = ctxr->c_cfg;
                /* Skip ordering an open context */
-               cfgsort[CTX_MAX] = cfgsort[nextctx];
-               cfgsort[nextctx] = '0';
+               if (order) {
+                       cfgsort[CTX_MAX] = cfgsort[nextctx];
+                       cfgsort[nextctx] = '0';
+               }
        } else { /* Set up a new context from current context */
                ctxr->c_cfg.ctxactive = 1;
                xstrsncpy(ctxr->c_path, path, PATH_MAX);
@@ -6577,16 +6579,18 @@ begin:
        }
 #endif
 
-       if (order && cfgsort[cfg.curctx] != '0') {
-               if (cfgsort[cfg.curctx] == 'z')
-                       set_sort_flags('c');
-               if ((!cfgsort[cfg.curctx] || (cfgsort[cfg.curctx] == 'c'))
-                   && ((r = get_kv_key(order, path, maxorder, NNN_ORDER)) > 0)) {
-                       set_sort_flags(r);
-                       cfgsort[cfg.curctx] = 'z';
-               }
-       } else
-               cfgsort[cfg.curctx] = cfgsort[CTX_MAX];
+       if (order) {
+               if (cfgsort[cfg.curctx] != '0') {
+                       if (cfgsort[cfg.curctx] == 'z')
+                               set_sort_flags('c');
+                       if ((!cfgsort[cfg.curctx] || (cfgsort[cfg.curctx] == 'c'))
+                           && ((r = get_kv_key(order, path, maxorder, NNN_ORDER)) > 0)) {
+                               set_sort_flags(r);
+                               cfgsort[cfg.curctx] = 'z';
+                       }
+               } else
+                       cfgsort[cfg.curctx] = cfgsort[CTX_MAX];
+       }
 
        populate(path, lastname);
        if (g_state.interrupt) {