fix: page up and down stop at the table edges instead of wrapping

A page is 20 rows and the index wrapped modulo one less than the row
count, so the last row was unreachable by paging, 21-row and 5-row tables
did nothing on page down from the first row, and 4-row tables cycled
0, 2, 1 and never reached row 3. Page down now clamps to the last row and
page up clamps to the first.

With no division left, a single-row table is safe, so the early return
only guards the empty table again, matching scroll_to_top and
scroll_to_bottom.
This commit is contained in:
Dark-Alex-17 committed 2026-09-17 17:38:37 -06:00
1 parent 1d936c5cb5
commit c42a46c7ca
4 files changed
+166 -47

No files matched your search

+3 -2
View File
@@ -606,17 +606,18 @@ mod tests {
.take(100)
.collect();
app.data.radarr_data.movies.set_items(movies_vec);
app.data.radarr_data.movies.state.select(Some(50));
TableHandlerUnit::new(key, &mut app, ActiveRadarrBlock::Movies, None).handle();
if key == Key::PgUp {
assert_str_eq!(
app.data.radarr_data.movies.current_selection().title.text,
"Test 79"
"Test 30"
);
} else {
assert_str_eq!(
app.data.radarr_data.movies.current_selection().title.text,
"Test 20"
"Test 70"
);
}
}