mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-24 09:21:16 -03:00
Do not allow empty items to be added to history
Empty items are used as sentinels to indicate that we've reached the end of history, so they should not be added as actual items. Enforce this. Fixes #6032
This commit is contained in:
@@ -3654,6 +3654,10 @@ void history_tests_t::test_history() {
|
||||
}
|
||||
history.save();
|
||||
|
||||
// Empty items should just be dropped (#6032).
|
||||
history.add(L"");
|
||||
do_test(!history.item_at_index(1).contents.empty());
|
||||
|
||||
// Read items back in reverse order and ensure they're the same.
|
||||
for (i = 100; i >= 1; i--) {
|
||||
history_item_t item = history.item_at_index(i);
|
||||
|
||||
Reference in New Issue
Block a user