repl-interacter: save history after entering every line
Fixes: https://git.lix.systems/lix-project/lix/issues/328 Change-Id: Iedd79ff5f72e84766ebd234c63856170afc624f0
This commit is contained in:
parent
40311973a8
commit
bfb91db4f6
2 changed files with 11 additions and 0 deletions
9
doc/manual/rl-next/repl-fix-history.md
Normal file
9
doc/manual/rl-next/repl-fix-history.md
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
---
|
||||||
|
synopsis: "`nix repl` history is saved more reliably"
|
||||||
|
cls: 1164
|
||||||
|
credits: puck
|
||||||
|
---
|
||||||
|
|
||||||
|
`nix repl` now saves its history file after each line, rather than at the end
|
||||||
|
of the session; ensuring that it will remember what you typed even after it
|
||||||
|
crashes.
|
|
@ -175,6 +175,8 @@ bool ReadlineLikeInteracter::getLine(std::string & input, ReplPromptType promptT
|
||||||
|
|
||||||
if (!s)
|
if (!s)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
write_history(historyFile.c_str());
|
||||||
input += s;
|
input += s;
|
||||||
input += '\n';
|
input += '\n';
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue