mirror of
https://github.com/nushell/nushell
synced 2024-11-10 15:14:14 +00:00
Adapt for improved history isolation in reedline (#10402)
Depends on https://github.com/nushell/reedline/pull/634 --------- Co-authored-by: WindSoilder <WindSoilder@outlook.com>
This commit is contained in:
parent
bc7736bc99
commit
f0a265dbee
3 changed files with 17 additions and 10 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -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",
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue