summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2021-02-26 13:05:54 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2021-02-26 13:05:54 -0500
commitef6ae187289dd58a3b03da8b991a8099616a763d (patch)
treeb7e22acc956ebf9c10f6df75a06cab6c1c0fc15d
parenta63ae9425561f3d2197c5d220be89fe92900adec (diff)
fix bug where selection_pos was invalid
-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) {