summaryrefslogtreecommitdiff
path: root/buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'buffer.c')
-rw-r--r--buffer.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/buffer.c b/buffer.c
index ca58772..54931ce 100644
--- a/buffer.c
+++ b/buffer.c
@@ -131,8 +131,11 @@ static void buffer_pos_validate(TextBuffer *buffer, BufferPos *p) {
p->index = line_len;
}
+// validate the cursor and selection positions
static void buffer_validate_cursor(TextBuffer *buffer) {
buffer_pos_validate(buffer, &buffer->cursor_pos);
+ if (buffer->selection)
+ buffer_pos_validate(buffer, &buffer->selection_pos);
}
static bool buffer_pos_valid(TextBuffer *buffer, BufferPos p) {