diff options
| author | 2019-01-24 12:05:13 +0530 | |
|---|---|---|
| committer | 2019-01-24 12:05:13 +0530 | |
| commit | 94e4201dc1f6973c4a03e60134c42c762d263baa (patch) | |
| tree | 8a217b7796237bc280626d5cce54da4f0ec04a4e /src | |
| parent | 31849fd5fb7b919a7cb99669c0bcd6f2685af2cc (diff) | |
| download | nnn-94e4201dc1f6973c4a03e60134c42c762d263baa.tar.gz | |
Use libreadline at command prompt
Diffstat (limited to 'src')
| -rw-r--r-- | src/nnn.c | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -78,6 +78,8 @@ #endif #include <locale.h> #include <pwd.h> +#include <readline/history.h> +#include <readline/readline.h> #include <regex.h> #include <signal.h> #include <stdarg.h> @@ -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); |