summaryrefslogtreecommitdiff
path: root/buffer.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2022-09-26 15:36:24 -0400
committerpommicket <pommicket@gmail.com>2022-09-26 15:36:24 -0400
commit44c338433284b0ecb3c30cef5aae0cdb3b06901f (patch)
treec5b470bbeb487ce74486e92112320398d59e560e /buffer.c
parentdfde7bff94240172d3a2a037ec0b77871b71bf56 (diff)
shift+pageup/pagedown
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