summaryrefslogtreecommitdiff
path: root/buffer.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2020-12-31 14:11:25 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2020-12-31 14:11:25 -0500
commitd7ae78179cf18bc79703ac2199e0ae03e556430f (patch)
tree3b580699a0a9f5dc2fb41d54936b19aeb90904e9 /buffer.c
parent185bf5b364efb4d7885ff5adcb69204e892ff5f7 (diff)
page up/down
Diffstat (limited to 'buffer.c')
-rw-r--r--buffer.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/buffer.c b/buffer.c
index e699548..c79a2df 100644
--- a/buffer.c
+++ b/buffer.c
@@ -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;