diff options
| author | Brooks Rady <b.j.rady@gmail.com> | 2021-04-22 00:25:43 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-22 00:25:43 +0100 |
| commit | 19fc0496a34565049cf1085ebf7071b7a6d3ef3d (patch) | |
| tree | f1ec6c15136949b9b5521275289a1bd7ab9ab194 /src/common/input | |
| parent | docs(changelog): update status bar change (diff) | |
| parent | add PGUP/PGDN to help info (diff) | |
| download | sl0ppij-19fc0496a34565049cf1085ebf7071b7a6d3ef3d.tar.gz sl0ppij-19fc0496a34565049cf1085ebf7071b7a6d3ef3d.tar.xz sl0ppij-19fc0496a34565049cf1085ebf7071b7a6d3ef3d.zip | |
feat(actions): allow scrolling by full pages
PR #298
Diffstat (limited to 'src/common/input')
| -rw-r--r-- | src/common/input/actions.rs | 4 | ||||
| -rw-r--r-- | src/common/input/handler.rs | 11 | ||||
| -rw-r--r-- | src/common/input/keybinds.rs | 5 |
3 files changed, 20 insertions, 0 deletions
diff --git a/src/common/input/actions.rs b/src/common/input/actions.rs index 47a5f763..3bcadf15 100644 --- a/src/common/input/actions.rs +++ b/src/common/input/actions.rs @@ -33,6 +33,10 @@ pub enum Action { ScrollUp, /// Scroll down in focus pane. ScrollDown, + /// Scroll up one page in focus pane. + PageScrollUp, + /// Scroll down one page in focus pane. + PageScrollDown, /// Toggle between fullscreen focus pane and normal layout. ToggleFocusFullscreen, /// Open a new pane in the specified direction (relative to focus). diff --git a/src/common/input/handler.rs b/src/common/input/handler.rs index 0afcab10..8abb2a0f 100644 --- a/src/common/input/handler.rs +++ b/src/common/input/handler.rs @@ -184,6 +184,16 @@ impl InputHandler { .send(ScreenInstruction::ScrollDown) .unwrap(); } + Action::PageScrollUp => { + self.send_screen_instructions + .send(ScreenInstruction::PageScrollUp) + .unwrap(); + } + Action::PageScrollDown => { + self.send_screen_instructions + .send(ScreenInstruction::PageScrollDown) + .unwrap(); + } Action::ToggleFocusFullscreen => { self.send_screen_instructions .send(ScreenInstruction::ToggleActiveTerminalFullscreen) @@ -293,6 +303,7 @@ pub fn get_mode_info(mode: InputMode) -> ModeInfo { } InputMode::Scroll => { keybinds.push(("↓↑".to_string(), "Scroll".to_string())); + keybinds.push(("PGUP/PGDN".to_string(), "Scroll Page".to_string())); } InputMode::RenameTab => { keybinds.push(("Enter".to_string(), "when done".to_string())); diff --git a/src/common/input/keybinds.rs b/src/common/input/keybinds.rs index 6239475e..8e04c44a 100644 --- a/src/common/input/keybinds.rs +++ b/src/common/input/keybinds.rs @@ -340,6 +340,11 @@ impl Keybinds { defaults.insert(Key::Char('j'), vec![Action::ScrollDown]); defaults.insert(Key::Char('k'), vec![Action::ScrollUp]); + defaults.insert(Key::Ctrl('f'), vec![Action::PageScrollDown]); + defaults.insert(Key::Ctrl('b'), vec![Action::PageScrollUp]); + defaults.insert(Key::PageDown, vec![Action::PageScrollDown]); + defaults.insert(Key::PageUp, vec![Action::PageScrollUp]); + defaults.insert(Key::Down, vec![Action::ScrollDown]); defaults.insert(Key::Up, vec![Action::ScrollUp]); |
