mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-23 01:46:18 +04:00
Support ctrl-f and ctrl-b to page up/down, fixes #41
This commit is contained in:
parent
0851110d10
commit
cbb3ebafdc
@ -473,10 +473,10 @@ fn scroll(cx: &mut Context, offset: usize, direction: Direction) {
|
||||
let last_line = view.last_line(doc);
|
||||
|
||||
// clamp into viewport
|
||||
let line = cursor.row.clamp(
|
||||
view.first_line + scrolloff,
|
||||
last_line.saturating_sub(scrolloff),
|
||||
);
|
||||
let line = cursor
|
||||
.row
|
||||
.min(view.first_line + scrolloff)
|
||||
.max(last_line.saturating_sub(scrolloff));
|
||||
|
||||
let text = doc.text().slice(..);
|
||||
let pos = pos_at_coords(text, Position::new(line, cursor.col)); // this func will properly truncate to line end
|
||||
|
@ -240,10 +240,12 @@ pub fn default() -> Keymaps {
|
||||
code: KeyCode::PageUp,
|
||||
modifiers: KeyModifiers::NONE
|
||||
} => commands::page_up,
|
||||
ctrl!('b') => commands::page_up,
|
||||
KeyEvent {
|
||||
code: KeyCode::PageDown,
|
||||
modifiers: KeyModifiers::NONE
|
||||
} => commands::page_down,
|
||||
ctrl!('f') => commands::page_down,
|
||||
ctrl!('u') => commands::half_page_up,
|
||||
ctrl!('d') => commands::half_page_down,
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user