aboutsummaryrefslogtreecommitdiffstats
path: root/src/nnn.c
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-02-10 09:58:13 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-02-10 09:58:13 +0530
commit929edaf243fc0acd598d10049302ce359d9ef97f (patch)
tree4d730cba044f0b614037609741d55961e70cc4bc /src/nnn.c
parent543814f5aab01b8439a30b341a094cfd9e87a228 (diff)
downloadnnn-929edaf243fc0acd598d10049302ce359d9ef97f.tar.gz
Fix https://github.com/mcchrish/nnn.vim/issues/39
If nnn is started in the picker mode, do NOT use libreadline. Fallback to the stock mechanism to show the command prompt.
Diffstat (limited to 'src/nnn.c')
-rw-r--r--src/nnn.c36
1 files changed, 22 insertions, 14 deletions
diff --git a/src/nnn.c b/src/nnn.c
index 02c53fa..6ca2e56 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -3888,27 +3888,35 @@ nochange:
}
break;
default: /* SEL_RUNCMD */
- exitcurses();
+ if (cfg.picker)
+ tmp = xreadline(NULL, "> ");
+ else {
+ /* Use libreadline */
+ exitcurses();
+
+ /* Switch to current path for readline(3) */
+ if (chdir(path) == -1) {
+ printwarn();
+ goto nochange;
+ }
- /* Switch to current path for readline(3) */
- if (chdir(path) == -1) {
- printwarn();
- goto nochange;
- }
+ tmp = readline("nnn> ");
- tmp = readline("nnn> ");
+ if (chdir(ipath) == -1) {
+ printwarn();
+ goto nochange;
+ }
- if (chdir(ipath) == -1) {
- printwarn();
- goto nochange;
+ refresh();
}
- refresh();
-
if (tmp && tmp[0]) {
spawn(shell, "-c", tmp, path, F_NORMAL | F_SIGINT);
- add_history(tmp);
- free(tmp);
+ if (!cfg.picker) {
+ /* readline finishing touches */
+ add_history(tmp);
+ free(tmp);
+ }
}
}