on master help sign in
Support ctrl-f and ctrl-b to page up/down, fixes #41
commitcbb3ebafdc6f2473264ad7cde99ddfff5a80a832 authorBlaž Hrastnik <blaz@mxxn.io> dateWed 2 Jun 2021, 13:19 (5 years ago) parent0851110
2 files changed+6−4
helix-term/src/commands.rs+4−4 helix-term/src/keymap.rs+2
helix-term/src/commands.rs+4−4
@@ -473,10 +473,10 @@ fn scroll(cx: &mut Context, offset: usize, direction: Direction) {
473473 let last_line = view.last_line(doc);
474474
475475 // clamp into viewport
476− let line = cursor.row.clamp(
477− view.first_line + scrolloff,
478− last_line.saturating_sub(scrolloff),
479− );
476+ let line = cursor
477+ .row
478+ .min(view.first_line + scrolloff)
479+ .max(last_line.saturating_sub(scrolloff));
480480
481481 let text = doc.text().slice(..);
482482 let pos = pos_at_coords(text, Position::new(line, cursor.col)); // this func will properly truncate to line end
helix-term/src/keymap.rs+2
@@ -240,10 +240,12 @@ pub fn default() -> Keymaps {
240240 code: KeyCode::PageUp,
241241 modifiers: KeyModifiers::NONE
242242 } => commands::page_up,
243+ ctrl!('b') => commands::page_up,
243244 KeyEvent {
244245 code: KeyCode::PageDown,
245246 modifiers: KeyModifiers::NONE
246247 } => commands::page_down,
248+ ctrl!('f') => commands::page_down,
247249 ctrl!('u') => commands::half_page_up,
248250 ctrl!('d') => commands::half_page_down,
249251