diff --git a/cursive/src/main.rs b/cursive/src/main.rs index 0953fb0..f9a3bbf 100644 --- a/cursive/src/main.rs +++ b/cursive/src/main.rs @@ -106,10 +106,10 @@ fn up(ui: &mut Cursive) { } fn page_down(ui: &mut Cursive) { - let mut l = ui - .find_name::>("results") - .unwrap(); - l.select_down(screen_height(ui)); + let rows = screen_height(&ui) - 7; + ui.call_on_name("results", |l: &mut SelectView| { + l.select_down(rows); + }); ui.call_on_name( "scroll_results", |l: &mut ScrollView>>>| { @@ -119,10 +119,10 @@ fn page_down(ui: &mut Cursive) { } fn page_up(ui: &mut Cursive) { - let mut l = ui - .find_name::>("results") - .unwrap(); - l.select_up(screen_height(ui)); + let rows = screen_height(&ui) - 7; + ui.call_on_name("results", |l: &mut SelectView| { + l.select_up(rows); + }); ui.call_on_name( "scroll_results", |l: &mut ScrollView>>>| {