diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2020-12-31 14:11:25 -0500 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2020-12-31 14:11:25 -0500 |
commit | d7ae78179cf18bc79703ac2199e0ae03e556430f (patch) | |
tree | 3b580699a0a9f5dc2fb41d54936b19aeb90904e9 /buffer.c | |
parent | 185bf5b364efb4d7885ff5adcb69204e892ff5f7 (diff) |
page up/down
Diffstat (limited to 'buffer.c')
-rw-r--r-- | buffer.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -695,6 +695,14 @@ void buffer_scroll(TextBuffer *buffer, double dx, double dy) { buffer_correct_scroll(buffer); } +void buffer_page_up(TextBuffer *buffer, i64 npages) { + buffer_scroll(buffer, 0, (double)(-npages * buffer_display_lines(buffer))); +} + +void buffer_page_down(TextBuffer *buffer, i64 npages) { + buffer_scroll(buffer, 0, (double)(+npages * buffer_display_lines(buffer))); +} + // returns the position of the character at the given position in the buffer. v2 buffer_pos_to_pixels(TextBuffer *buffer, BufferPos pos) { u32 line = pos.line, index = pos.index; |