about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-09-06T11·14+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-09-06T11·14+0200
commit0b419c048b206e2fe68758ea1bd5fa7b1c29c521 (patch)
tree5c156d984a76ef40fddc2936920e953371243829
parent4fb82d3d800be9a53631c3c8a3321a359306d835 (diff)
Use readline history file
-rw-r--r--nix-repl.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/nix-repl.cc b/nix-repl.cc
index bb205211793f..bb18359c155e 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;