forked from lix-project/lix
Merge pull request #2551 from KaiHa/kaiha/libreadline_option
repl: give user the choice between libeditline and libreadline
This commit is contained in:
commit
338fcec779
|
@ -5,7 +5,12 @@
|
||||||
|
|
||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
|
|
||||||
|
#ifdef READLINE
|
||||||
|
#include <readline/history.h>
|
||||||
|
#include <readline/readline.h>
|
||||||
|
#else
|
||||||
#include <editline.h>
|
#include <editline.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "shared.hh"
|
#include "shared.hh"
|
||||||
#include "eval.hh"
|
#include "eval.hh"
|
||||||
|
@ -202,13 +207,15 @@ void NixRepl::mainLoop(const std::vector<std::string> & files)
|
||||||
// Allow nix-repl specific settings in .inputrc
|
// Allow nix-repl specific settings in .inputrc
|
||||||
rl_readline_name = "nix-repl";
|
rl_readline_name = "nix-repl";
|
||||||
createDirs(dirOf(historyFile));
|
createDirs(dirOf(historyFile));
|
||||||
|
#ifndef READLINE
|
||||||
el_hist_size = 1000;
|
el_hist_size = 1000;
|
||||||
|
#endif
|
||||||
read_history(historyFile.c_str());
|
read_history(historyFile.c_str());
|
||||||
// rl_initialize();
|
|
||||||
// linenoiseSetCompletionCallback(completionCallback);
|
|
||||||
curRepl = this;
|
curRepl = this;
|
||||||
|
#ifndef READLINE
|
||||||
rl_set_complete_func(completionCallback);
|
rl_set_complete_func(completionCallback);
|
||||||
rl_set_list_possib_func(listPossibleCallback);
|
rl_set_list_possib_func(listPossibleCallback);
|
||||||
|
#endif
|
||||||
|
|
||||||
std::string input;
|
std::string input;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue