Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
micielski committed Jun 20, 2024
2 parents 16cb4cb + 31ce354 commit 5e068f3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions rm-main/src/ui/components/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ impl<T: Clone> GenericTable<T> {
pub fn next(&mut self) {
let mut state = self.state.borrow_mut();
if let Some(curr) = state.selected() {
if curr == self.get_len() {
let last_idx = self.get_len() - 1;
if curr == last_idx {
state.select(Some(0));
} else {
state.select(Some(curr + 1));
Expand All @@ -52,8 +53,9 @@ impl<T: Clone> GenericTable<T> {
let mut state = self.state.borrow_mut();

if let Some(curr) = state.selected() {
let last_idx = self.get_len() - 1;
if curr == 0 {
state.select(Some(self.get_len()));
state.select(Some(last_idx));
} else {
state.select(Some(curr - 1));
}
Expand Down

0 comments on commit 5e068f3

Please sign in to comment.