summaryrefslogtreecommitdiff
path: root/buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'buffer.c')
-rw-r--r--buffer.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/buffer.c b/buffer.c
index 4ee4fbd..be0c07e 100644
--- a/buffer.c
+++ b/buffer.c
@@ -842,14 +842,6 @@ 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;
@@ -1555,6 +1547,22 @@ void buffer_disable_selection(TextBuffer *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));
+}
+
+void buffer_select_page_up(TextBuffer *buffer, i64 npages) {
+ buffer_select_up(buffer, npages * (i64)buffer_display_lines(buffer));
+}
+
+void buffer_select_page_down(TextBuffer *buffer, i64 npages) {
+ buffer_select_down(buffer, npages * (i64)buffer_display_lines(buffer));
+}
+
static void buffer_shorten_line(Line *line, u32 new_len) {
assert(line->len >= new_len);
line->len = new_len; // @OPTIMIZE(memory): decrease line capacity