Merge pull request #180 from meain/scroll-fix

Fix next_page selection calculation
This commit is contained in:
Dheepak Krishnamurthy 2021-04-06 23:31:57 -06:00 committed by GitHub
commit 55dbcd41ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1187,16 +1187,19 @@ impl TaskwarriorTuiApp {
return;
}
let i = {
if self.current_selection >= self.tasks.len() - 1 {
if self.current_selection == self.tasks.len() - 1 {
if self.config.uda_task_report_looping {
0
} else {
self.current_selection
self.tasks.len() - 1
}
} else {
self.current_selection
.checked_add(self.task_report_height as usize)
.unwrap_or_else(|| self.tasks.len())
std::cmp::min(
self.current_selection
.checked_add(self.task_report_height as usize)
.unwrap_or_else(|| self.tasks.len() - 1),
self.tasks.len() - 1,
)
}
};
self.current_selection = i;