From 090842bd8e8890c40cf40a4430bae1b073515c40 Mon Sep 17 00:00:00 2001 From: Jerry Yin Date: Mon, 8 Apr 2019 12:50:06 -0700 Subject: Add ScrollLineUp and ScrollLineDown actions for scrolling line by line --- src/input.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/input.rs') diff --git a/src/input.rs b/src/input.rs index 8ce8f2cd..9619ffa7 100644 --- a/src/input.rs +++ b/src/input.rs @@ -220,6 +220,12 @@ pub enum Action { /// Scroll exactly one page down ScrollPageDown, + /// Scroll one line up + ScrollLineUp, + + /// Scroll one line down + ScrollLineDown, + /// Scroll all the way to the top ScrollToTop, @@ -317,6 +323,12 @@ impl Action { Action::ScrollPageDown => { ctx.scroll(Scroll::PageDown); }, + Action::ScrollLineUp => { + ctx.scroll(Scroll::Lines(1)); + }, + Action::ScrollLineDown => { + ctx.scroll(Scroll::Lines(-1)); + }, Action::ScrollToTop => { ctx.scroll(Scroll::Top); }, -- cgit