mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-06 08:51:14 -03:00
Minor refactoring of add_to_history
Preparation for other refactoring in the future.
This commit is contained in:
@@ -6111,19 +6111,20 @@ fn add_to_history(&mut self) {
|
||||
|
||||
// Remove ephemeral items - even if the text is empty.
|
||||
self.history.remove_ephemeral_items();
|
||||
|
||||
if !text.is_empty() {
|
||||
// Mark this item as ephemeral if should_add_to_history says no (#615).
|
||||
let mode = if !self.should_add_to_history(&text) {
|
||||
PersistenceMode::Ephemeral
|
||||
} else if in_private_mode(self.vars()) {
|
||||
PersistenceMode::Memory
|
||||
} else {
|
||||
PersistenceMode::Disk
|
||||
};
|
||||
self.history
|
||||
.add_pending_with_file_detection(&text, &self.parser.variables, mode);
|
||||
if text.is_empty() {
|
||||
return;
|
||||
}
|
||||
|
||||
// Mark this item as ephemeral if should_add_to_history says no (#615).
|
||||
let mode = if !self.should_add_to_history(&text) {
|
||||
PersistenceMode::Ephemeral
|
||||
} else if in_private_mode(self.vars()) {
|
||||
PersistenceMode::Memory
|
||||
} else {
|
||||
PersistenceMode::Disk
|
||||
};
|
||||
self.history
|
||||
.add_pending_with_file_detection(&text, &self.parser.variables, mode);
|
||||
}
|
||||
|
||||
/// Check if we have background jobs that we have not warned about.
|
||||
|
||||
Reference in New Issue
Block a user