aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2018-11-20 16:16:31 +0100
committerGitHub <noreply@github.com>2018-11-20 16:16:31 +0100
commit338fcec779a5afb63b333479b5ce88357cd97c0d (patch)
tree47e9d47e54819bebe79d7a773ce3c12222e192df /src
parent2f8255cba1597aa1d7afefcac0a33bec63e0ceb6 (diff)
parentde5997332d0f9b1347978ea0d4e7ead2b59d2dd6 (diff)
Merge pull request #2551 from KaiHa/kaiha/libreadline_option
repl: give user the choice between libeditline and libreadline
Diffstat (limited to 'src')
-rw-r--r--src/nix/repl.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/nix/repl.cc b/src/nix/repl.cc
index ff8477865..d93fd770e 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;