mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-29 06:13:20 +00:00
Fix crash in the history pager
Delete the last shown entry and it'll subtract with overflow
This commit is contained in:
parent
26ea024e74
commit
9ff02d6a7f
1 changed files with 3 additions and 0 deletions
|
@ -827,6 +827,9 @@ impl Pager {
|
||||||
pub fn set_selected_completion_index(&mut self, mut new_index: Option<usize>) {
|
pub fn set_selected_completion_index(&mut self, mut new_index: Option<usize>) {
|
||||||
// Current users are off by one at most.
|
// Current users are off by one at most.
|
||||||
assert!(new_index.is_none_or(|new_index| new_index <= self.completion_infos.len()));
|
assert!(new_index.is_none_or(|new_index| new_index <= self.completion_infos.len()));
|
||||||
|
if self.completion_infos.is_empty() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if new_index == Some(self.completion_infos.len()) {
|
if new_index == Some(self.completion_infos.len()) {
|
||||||
new_index = Some(self.completion_infos.len() - 1);
|
new_index = Some(self.completion_infos.len() - 1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue