This commit is contained in:
sxyazi 2023-08-30 21:43:13 +08:00
parent 0b98859488
commit c388f6f2c2
No known key found for this signature in database
2 changed files with 6 additions and 6 deletions

View file

@ -50,9 +50,9 @@ impl Help {
#[inline] #[inline]
pub fn arrow(&mut self, step: isize) -> bool { pub fn arrow(&mut self, step: isize) -> bool {
let len = self.bindings.len(); let max = self.bindings.len().saturating_sub(1);
self.offset = self.offset.min(len); self.offset = self.offset.min(max);
self.cursor = self.cursor.min(len.saturating_sub(1)); self.cursor = self.cursor.min(max);
if step > 0 { self.next(step as usize) } else { self.prev(step.unsigned_abs()) } if step > 0 { self.next(step as usize) } else { self.prev(step.unsigned_abs()) }
} }

View file

@ -35,9 +35,9 @@ impl Folder {
return false; return false;
} }
let len = self.files.len(); let max = self.files.len().saturating_sub(1);
self.offset = self.offset.min(len); self.offset = self.offset.min(max);
self.cursor = self.cursor.min(len.saturating_sub(1)); self.cursor = self.cursor.min(max);
self.set_page(true); self.set_page(true);
self.hover_repos(); self.hover_repos();