summaryrefslogtreecommitdiff
path: root/buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'buffer.c')
-rw-r--r--buffer.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/buffer.c b/buffer.c
index 8371c7c..50bdbe7 100644
--- a/buffer.c
+++ b/buffer.c
@@ -1119,12 +1119,22 @@ void buffer_cursor_move_to_pos(TextBuffer *buffer, BufferPos pos) {
if (buffer_pos_eq(buffer->cursor_pos, pos)) {
return;
}
+
+ if (labs((long)buffer->cursor_pos.line - (long)pos.line) > 20) {
+ // if this is a big jump, update the previous cursor pos
+ buffer->prev_cursor_pos = buffer->cursor_pos;
+ }
+
buffer->cursor_pos = pos;
buffer->selection = false;
buffer_scroll_to_cursor(buffer);
signature_help_retrigger(buffer->ted);
}
+void buffer_cursor_move_to_prev_pos(TextBuffer *buffer) {
+ buffer_cursor_move_to_pos(buffer, buffer->prev_cursor_pos);
+}
+
i64 buffer_cursor_move_left(TextBuffer *buffer, i64 by) {
BufferPos cur_pos = buffer->cursor_pos;
i64 ret = 0;