Skip to content

Commit

Permalink
Adapt for improved history isolation in reedline (nushell#10402)
Browse files Browse the repository at this point in the history
Depends on nushell/reedline#634

---------

Co-authored-by: WindSoilder <[email protected]>
  • Loading branch information
2 people authored and hardfau1t committed Dec 14, 2023
1 parent e76faaa commit 84d79a2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 8 additions & 6 deletions crates/nu-cli/src/commands/history.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,14 @@ impl Command for History {
} else {
let history_reader: Option<Box<dyn ReedlineHistory>> =
match engine_state.config.history_file_format {
HistoryFileFormat::Sqlite => SqliteBackedHistory::with_file(history_path)
.map(|inner| {
let boxed: Box<dyn ReedlineHistory> = Box::new(inner);
boxed
})
.ok(),
HistoryFileFormat::Sqlite => {
SqliteBackedHistory::with_file(history_path, None, None)
.map(|inner| {
let boxed: Box<dyn ReedlineHistory> = Box::new(inner);
boxed
})
.ok()
}

HistoryFileFormat::PlainText => FileBackedHistory::with_file(
engine_state.config.max_history_size as usize,
Expand Down
11 changes: 8 additions & 3 deletions crates/nu-cli/src/repl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 84d79a2

Please sign in to comment.