diff options
author | Sam Tay <sam.chong.tay@gmail.com> | 2020-06-28 18:27:52 -0700 |
---|---|---|
committer | Sam Tay <sam.chong.tay@gmail.com> | 2020-06-28 18:27:52 -0700 |
commit | f9aed867ca8b9dea01647e57fec70393f8e053cb (patch) | |
tree | 384c16710d04c5381693ce74f3145ef6e54f6b31 /src | |
parent | e804835d1bc3c40b74745c2102f73c81c35c952c (diff) |
Improve scrolling controls
Diffstat (limited to 'src')
-rw-r--r-- | src/tui/app.rs | 12 | ||||
-rw-r--r-- | src/tui/views.rs | 17 |
2 files changed, 22 insertions, 7 deletions
diff --git a/src/tui/app.rs b/src/tui/app.rs index 023955f..5d2515a 100644 --- a/src/tui/app.rs +++ b/src/tui/app.rs @@ -148,11 +148,13 @@ pub fn help() -> Dialog { **Space**: Cycle layout (4 Pane, 2 Pane, FullScreen) ## Scroll -**h,j,k,l**: ←,↓,↑,→ -**Ctrl<b>, Ctrl<u>**: ↑ x 10 -**Ctrl<f>, Ctrl<d>**: ↓ x 10 -**gg**: Scroll To Top -**G**: Scroll To Bottom +**h,j,k,l**: ←,↓,↑,→ +**Ctrl<u>**: ↑ x 5 +**Ctrl<d>**: ↓ x 5 +**Ctrl<b>**: ↑ x 10 +**Ctrl<f>**: ↓ x 10 +**gg**: Scroll To Top +**G**: Scroll To Bottom ## Misc **ZZ, Ctrl<c>**: Exit diff --git a/src/tui/views.rs b/src/tui/views.rs index 3dc12a8..f191830 100644 --- a/src/tui/views.rs +++ b/src/tui/views.rs @@ -550,12 +550,25 @@ impl<T: View> ViewWrapper for VimBindingsView<T> { Event::Char('l') => { return self.view.on_event(Event::Key(Key::Right)); } - Event::CtrlChar('d') | Event::CtrlChar('f') => { + Event::CtrlChar('d') => { return self.view.on_event(Event::Key(Key::PageDown)); } - Event::CtrlChar('u') | Event::CtrlChar('b') => { + Event::CtrlChar('f') => { + // Double page down + let res = self.view.on_event(Event::Key(Key::PageDown)); + self.view.on_event(Event::Key(Key::PageDown)); + // Return whether or not initial page down was consumed + return res; + } + Event::CtrlChar('u') => { return self.view.on_event(Event::Key(Key::PageUp)); } + Event::CtrlChar('b') => { + // Double page up + let res = self.view.on_event(Event::Key(Key::PageUp)); + self.view.on_event(Event::Key(Key::PageUp)); + return res; + } Event::Char('G') => { return self.view.on_event(Event::Key(Key::End)); } |