From 0b419c048b206e2fe68758ea1bd5fa7b1c29c521 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 6 Sep 2013 13:14:28 +0200 Subject: [PATCH] Use readline history file --- nix-repl.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/nix-repl.cc b/nix-repl.cc index bb2052117..bb18359c1 100644 --- a/nix-repl.cc +++ b/nix-repl.cc @@ -71,7 +71,10 @@ bool getLine(string & line) if (!s) return false; line = chomp(string(s)); free(s); - if (line != "") add_history(line.c_str()); + if (line != "") { + add_history(line.c_str()); + append_history(1, 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; + using_history(); + read_history(0); + while (true) { string line; if (!getLine(line)) break;