From f0a265dbee380c9ec0735392a865d6b4eab8bb66 Mon Sep 17 00:00:00 2001 From: Hofer-Julian <30049909+Hofer-Julian@users.noreply.github.com> Date: Mon, 18 Sep 2023 07:49:26 +0200 Subject: [PATCH] Adapt for improved history isolation in reedline (#10402) Depends on https://github.com/nushell/reedline/pull/634 --------- Co-authored-by: WindSoilder --- Cargo.lock | 2 +- crates/nu-cli/src/commands/history.rs | 14 ++++++++------ crates/nu-cli/src/repl.rs | 11 ++++++++--- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 04093a7cfe..18f8143d80 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4293,7 +4293,7 @@ dependencies = [ [[package]] name = "reedline" version = "0.23.0" -source = "git+https://github.com/nushell/reedline.git?branch=main#31257a4c5413d4a262912359f515907b8295db5c" +source = "git+https://github.com/nushell/reedline.git?branch=main#f9939396905a81841645da30b411f3a255c7a037" dependencies = [ "chrono", "crossterm 0.27.0", diff --git a/crates/nu-cli/src/commands/history.rs b/crates/nu-cli/src/commands/history.rs index 0280ccb787..3021cac271 100644 --- a/crates/nu-cli/src/commands/history.rs +++ b/crates/nu-cli/src/commands/history.rs @@ -70,12 +70,14 @@ impl Command for History { } else { let history_reader: Option> = match engine_state.config.history_file_format { - HistoryFileFormat::Sqlite => SqliteBackedHistory::with_file(history_path) - .map(|inner| { - let boxed: Box = Box::new(inner); - boxed - }) - .ok(), + HistoryFileFormat::Sqlite => { + SqliteBackedHistory::with_file(history_path, None, None) + .map(|inner| { + let boxed: Box = Box::new(inner); + boxed + }) + .ok() + } HistoryFileFormat::PlainText => FileBackedHistory::with_file( engine_state.config.max_history_size as usize, diff --git a/crates/nu-cli/src/repl.rs b/crates/nu-cli/src/repl.rs index b27d84961c..7898285bb9 100644 --- a/crates/nu-cli/src/repl.rs +++ b/crates/nu-cli/src/repl.rs @@ -730,9 +730,14 @@ fn update_line_editor_history( ) .into_diagnostic()?, ), - HistoryFileFormat::Sqlite => { - Box::new(SqliteBackedHistory::with_file(history_path.to_path_buf()).into_diagnostic()?) - } + HistoryFileFormat::Sqlite => Box::new( + SqliteBackedHistory::with_file( + history_path.to_path_buf(), + history_session_id, + Some(chrono::Utc::now()), + ) + .into_diagnostic()?, + ), }; let line_editor = line_editor .with_history_session_id(history_session_id)