aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2020-02-17 20:34:03 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2020-02-17 20:34:03 +0530
commit9cf77708a1e1d9ec94afacd68847dcb6e98e1c27 (patch)
tree6da36d0d053ce3f0b799b8aeb8081c655d27d775 /src
parent1a8f9ee45928486339726cbf652cacb2f2dd4216 (diff)
downloadnnn-9cf77708a1e1d9ec94afacd68847dcb6e98e1c27.tar.gz
Late get and set NNNLVL before spawning shell
Diffstat (limited to 'src')
-rw-r--r--src/nnn.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/nnn.c b/src/nnn.c
index d6be43c..06c677e 100644
--- 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;