apply changes proposed by adam

Co-authored-by: Adam Perkowski <adas1per@protonmail.com>
This commit is contained in:
Nyx 2024-10-02 03:17:48 -04:00 committed by GitHub
parent 8276d28b8d
commit 063d512bc8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -512,9 +512,6 @@ impl AppState {
fn scroll_down(&mut self) { fn scroll_down(&mut self) {
let len = self.filter.item_list().len(); let len = self.filter.item_list().len();
if len == 0 {
return;
}
let current = self.selection.selected().unwrap_or(0); let current = self.selection.selected().unwrap_or(0);
let max_index = if self.at_root() { len - 1 } else { len }; let max_index = if self.at_root() { len - 1 } else { len };
let next = if current + 1 > max_index { let next = if current + 1 > max_index {
@ -527,9 +524,6 @@ impl AppState {
fn scroll_up(&mut self) { fn scroll_up(&mut self) {
let len = self.filter.item_list().len(); let len = self.filter.item_list().len();
if len == 0 {
return;
}
let current = self.selection.selected().unwrap_or(0); let current = self.selection.selected().unwrap_or(0);
let max_index = if self.at_root() { len - 1 } else { len }; let max_index = if self.at_root() { len - 1 } else { len };
let next = if current == 0 { max_index } else { current - 1 }; let next = if current == 0 { max_index } else { current - 1 };