aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-01-27 15:11:45 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-01-27 15:11:45 +0530
commit2669278a31600efe7f750d71e4966b95ffcc4511 (patch)
tree527cb423535cc33305bfdb61a9d4ec37f99dd9b4 /src
parentd47be4e89b57398e0964e3cdbe76cab4f3e44a17 (diff)
downloadnnn-2669278a31600efe7f750d71e4966b95ffcc4511.tar.gz
Change dir before readline()
Diffstat (limited to 'src')
-rw-r--r--src/nnn.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/nnn.c b/src/nnn.c
index 6f27339..ce46c1c 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -3709,8 +3709,22 @@ nochange:
break;
default: /* SEL_RUNCMD */
exitcurses();
+
+ /* Switch to current path for readline(3) */
+ if (chdir(path) == -1) {
+ printwarn();
+ goto nochange;
+ }
+
tmp = readline("nnn> ");
+
+ if (chdir(ipath) == -1) {
+ printwarn();
+ goto nochange;
+ }
+
refresh();
+
if (tmp && tmp[0]) {
spawn(shell, "-c", tmp, path, F_NORMAL | F_SIGINT);
add_history(tmp);