]> Sergey Matveev's repositories - nnn.git/commitdiff
Late get and set NNNLVL before spawning shell
authorArun Prakash Jana <engineerarun@gmail.com>
Mon, 17 Feb 2020 15:04:03 +0000 (20:34 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Mon, 17 Feb 2020 15:04:03 +0000 (20:34 +0530)
src/nnn.c

index d6be43c5eefdc70f157deeae952a8b038b9c2b1f..06c677e08aaaba20b16be0138ac478144bb96eaa 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -5913,6 +5913,10 @@ nochange:
 
                        switch (sel) {
                        case SEL_SHELL:
+                               /* Set nnn nesting level */
+                               tmp = getenv(env_cfg[NNNLVL]);
+                               setenv(env_cfg[NNNLVL], xitoa((tmp ? atoi(tmp) : 0) + 1), 1);
+
                                setenv(envs[ENV_NCUR], (ndents ? dents[cur].name : ""), 1);
                                spawn(shell, NULL, NULL, path, F_CLI);
                                break;
@@ -6710,10 +6714,7 @@ int main(int argc, char *argv[])
        }
 #endif
 
-       /* Set nnn nesting level */
-       arg = getenv(env_cfg[NNNLVL]);
-       setenv(env_cfg[NNNLVL], xitoa((arg ? atoi(arg) : 0) + 1), 1);
-
+       /* Configure trash preference */
        if (xgetenv_set(env_cfg[NNN_TRASH]))
                cfg.trash = 1;