Skip to content

Commit

Permalink
undo changes proposed by adam in scroll up and down funcs
Browse files Browse the repository at this point in the history
  • Loading branch information
nnyyxxxx committed Oct 2, 2024
1 parent c12097d commit 544cbd4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tui/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,9 @@ impl AppState {

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

fn scroll_up(&mut self) {
let len = self.filter.item_list().len();
if len == 0 {
return;
}
let current = self.selection.selected().unwrap_or(0);
let max_index = if self.at_root() { len - 1 } else { len };
let next = if current == 0 { max_index } else { current - 1 };
Expand Down

0 comments on commit 544cbd4

Please sign in to comment.