Use readline history file
This commit is contained in:
parent
4fb82d3d80
commit
0b419c048b
1 changed files with 7 additions and 1 deletions
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue