diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2018-11-20T15·16+0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-20T15·16+0100 |
commit | 338fcec779a5afb63b333479b5ce88357cd97c0d (patch) | |
tree | 47e9d47e54819bebe79d7a773ce3c12222e192df | |
parent | 2f8255cba1597aa1d7afefcac0a33bec63e0ceb6 (diff) | |
parent | de5997332d0f9b1347978ea0d4e7ead2b59d2dd6 (diff) |
Merge pull request #2551 from KaiHa/kaiha/libreadline_option
repl: give user the choice between libeditline and libreadline
-rw-r--r-- | src/nix/repl.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/nix/repl.cc b/src/nix/repl.cc index ff8477865b5f..d93fd770e807 100644 --- a/src/nix/repl.cc +++ b/src/nix/repl.cc @@ -5,7 +5,12 @@ #include <setjmp.h> +#ifdef READLINE +#include <readline/history.h> +#include <readline/readline.h> +#else #include <editline.h> +#endif #include "shared.hh" #include "eval.hh" @@ -202,13 +207,15 @@ void NixRepl::mainLoop(const std::vector<std::string> & files) // Allow nix-repl specific settings in .inputrc rl_readline_name = "nix-repl"; createDirs(dirOf(historyFile)); +#ifndef READLINE el_hist_size = 1000; +#endif read_history(historyFile.c_str()); - // rl_initialize(); - // linenoiseSetCompletionCallback(completionCallback); curRepl = this; +#ifndef READLINE rl_set_complete_func(completionCallback); rl_set_list_possib_func(listPossibleCallback); +#endif std::string input; |