summaryrefslogtreecommitdiff
path: root/buffer.c
diff options
context:
space:
mode:
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;