From 94e4201dc1f6973c4a03e60134c42c762d263baa Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Thu, 24 Jan 2019 12:05:13 +0530 Subject: Use libreadline at command prompt --- src/nnn.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nnn.c b/src/nnn.c index 178eb96..e516752 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -78,6 +78,8 @@ #endif #include #include +#include +#include #include #include #include @@ -3710,9 +3712,14 @@ nochange: } break; default: /* SEL_RUNCMD */ - tmp = xreadline(NULL, "> "); - if (tmp && tmp[0]) + exitcurses(); + tmp = readline("nnn> "); + refresh(); + if (tmp && tmp[0]) { spawn(shell, "-c", tmp, path, F_NORMAL | F_SIGINT); + add_history(tmp); + free(tmp); + } } /* Continue in navigate-as-you-type mode, if enabled */ @@ -4022,6 +4029,11 @@ int main(int argc, char *argv[]) setlocale(LC_ALL, ""); crc8init(); + /* Bind TAB to cycling */ + rl_variable_bind("completion-ignore-case", "on"); + rl_bind_key('\t', rl_menu_complete); + read_history(NULL); + #ifdef DEBUGMODE enabledbg(); #endif @@ -4031,6 +4043,8 @@ int main(int argc, char *argv[]) browse(ipath); exitcurses(); + write_history(NULL); + if (cfg.pickraw) { if (copybufpos) { opt = selectiontofd(1); -- cgit v1.2.3-70-g09d2