apply changes proposed by adam round 2

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

View File

@ -519,6 +519,7 @@ impl AppState {
} else { } else {
current + 1 current + 1
}; };
self.selection.select(Some(next)); self.selection.select(Some(next));
} }
@ -527,6 +528,7 @@ impl AppState {
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 };
self.selection.select(Some(next)); self.selection.select(Some(next));
} }
@ -757,6 +759,7 @@ impl AppState {
let len = self.tabs.len(); let len = self.tabs.len();
let current = self.current_tab.selected().unwrap_or(0); let current = self.current_tab.selected().unwrap_or(0);
let next = if current + 1 >= len { 0 } else { current + 1 }; let next = if current + 1 >= len { 0 } else { current + 1 };
self.current_tab.select(Some(next)); self.current_tab.select(Some(next));
self.refresh_tab(); self.refresh_tab();
} }
@ -765,6 +768,7 @@ impl AppState {
let len = self.tabs.len(); let len = self.tabs.len();
let current = self.current_tab.selected().unwrap_or(0); let current = self.current_tab.selected().unwrap_or(0);
let next = if current == 0 { len - 1 } else { current - 1 }; let next = if current == 0 { len - 1 } else { current - 1 };
self.current_tab.select(Some(next)); self.current_tab.select(Some(next));
self.refresh_tab(); self.refresh_tab();
} }