Skip to content

Commit

Permalink
Scroll the whole page on PageDown/PageUp
Browse files Browse the repository at this point in the history
  • Loading branch information
azat authored and gyscos committed Oct 3, 2023
1 parent c798fe4 commit bfc6eab
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cursive-core/src/view/scroll/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,11 +297,13 @@ pub fn on_event<Model: ?Sized>(
get_scroller(model).scroll_up(1);
}
Event::Key(Key::PageUp) if get_scroller(model).can_scroll_up() => {
get_scroller(model).scroll_up(5);
let scroller = get_scroller(model);
scroller.scroll_up(scroller.last_available_size().y);
}
Event::Key(Key::PageDown) if get_scroller(model).can_scroll_down() => {
// No `min` check here - we allow going over the edge.
get_scroller(model).scroll_down(5);
let scroller = get_scroller(model);
scroller.scroll_down(scroller.last_available_size().y);
}
Event::Ctrl(Key::Down) | Event::Key(Key::Down)
if get_scroller(model).can_scroll_down() =>
Expand Down

0 comments on commit bfc6eab

Please sign in to comment.