From a92ff5727032163c54e82278a67aa1a6c5a21d31 Mon Sep 17 00:00:00 2001 From: Martin Mauch Date: Wed, 14 Apr 2021 20:20:25 +0200 Subject: [PATCH] Use append_history instead of save_history to preserve existing history (#3314) --- crates/nu-cli/src/cli.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/nu-cli/src/cli.rs b/crates/nu-cli/src/cli.rs index 0952d421a9..6d24c49ffc 100644 --- a/crates/nu-cli/src/cli.rs +++ b/crates/nu-cli/src/cli.rs @@ -342,7 +342,7 @@ pub fn cli(context: EvaluationContext, options: Options) -> Result<(), Box { if options.save_history && !line.trim().is_empty() { rl.add_history_entry(&line); - let _ = rl.save_history(&history_path); + let _ = rl.append_history(&history_path); } maybe_print_errors(&context, Text::from(session_text.clone())); } @@ -350,14 +350,14 @@ pub fn cli(context: EvaluationContext, options: Options) -> Result<(), Box { if options.save_history { rl.clear_history(); - let _ = rl.save_history(&history_path); + let _ = rl.append_history(&history_path); } } LineResult::Error(line, err) => { if options.save_history && !line.trim().is_empty() { rl.add_history_entry(&line); - let _ = rl.save_history(&history_path); + let _ = rl.append_history(&history_path); } context @@ -390,7 +390,7 @@ pub fn cli(context: EvaluationContext, options: Options) -> Result<(), Box Result<(), Box