From a281c9fe144c1ca9a34cfb07756fbd1415950ec2 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Fri, 24 May 2024 21:17:27 +0200 Subject: [PATCH] Scroll the whole page on Left/Right arrows (#764) Seeking char by char can take awhile... --- cursive-core/src/view/scroll/raw.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cursive-core/src/view/scroll/raw.rs b/cursive-core/src/view/scroll/raw.rs index 707b515a..f46916ff 100644 --- a/cursive-core/src/view/scroll/raw.rs +++ b/cursive-core/src/view/scroll/raw.rs @@ -313,12 +313,14 @@ pub fn on_event( Event::Ctrl(Key::Left) | Event::Key(Key::Left) if get_scroller(model).can_scroll_left() => { - get_scroller(model).scroll_left(1); + let scroller = get_scroller(model); + scroller.scroll_left(scroller.last_available_size().x); } Event::Ctrl(Key::Right) | Event::Key(Key::Right) if get_scroller(model).can_scroll_right() => { - get_scroller(model).scroll_right(1); + let scroller = get_scroller(model); + scroller.scroll_right(scroller.last_available_size().x); } _ => return EventResult::Ignored, };