Use readline history file

This commit is contained in:
Eelco Dolstra 2013-09-06 13:14:28 +02:00
parent 4fb82d3d80
commit 0b419c048b

View file

@ -71,7 +71,10 @@ bool getLine(string & line)
if (!s) return false; if (!s) return false;
line = chomp(string(s)); line = chomp(string(s));
free(s); free(s);
if (line != "") add_history(line.c_str()); if (line != "") {
add_history(line.c_str());
append_history(1, 0);
}
} }
_isInterrupted = 0; _isInterrupted = 0;
@ -109,6 +112,9 @@ void NixRepl::mainLoop()
{ {
std::cerr << "Welcome to Nix version " << NIX_VERSION << ". Type :? for help." << std::endl << std::endl; std::cerr << "Welcome to Nix version " << NIX_VERSION << ". Type :? for help." << std::endl << std::endl;
using_history();
read_history(0);
while (true) { while (true) {
string line; string line;
if (!getLine(line)) break; if (!getLine(line)) break;