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:
Hofer-Julian
2023-09-18 07:49:26 +02:00
committed by GitHub
parent bc7736bc99
commit f0a265dbee
3 changed files with 17 additions and 10 deletions

View File

@ -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,

View File

@ -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)