summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2020-11-29 18:47:08 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2020-11-29 18:47:08 -0500
commit7c0d13f907043728b75af73824be6fdf066458d2 (patch)
treef066804fe5c1e11e9577d9f9d8328fbd95191b6c
parentc4fdc35b3b21faecda42e434b28e4fb6db39d3e6 (diff)
oops fix cursor moving
-rw-r--r--buffer.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/buffer.c b/buffer.c
index 6f22b29..25f3f1a 100644
--- a/buffer.c
+++ b/buffer.c
@@ -8,7 +8,7 @@
#include "text.h"
// @TODO: make this bigger -- maybe 4000 (it's small now to test having a bunch of blocks)
-#define TEXT_BLOCK_MAX_SIZE 400
+#define TEXT_BLOCK_MAX_SIZE 100
// Once two adjacent blocks are at most this big, combine them into
// one bigger text block.
#define TEXT_BLOCK_COMBINE_SIZE (3*(TEXT_BLOCK_MAX_SIZE / 4))
@@ -371,6 +371,7 @@ static bool buffer_pos_move_left(TextBuffer *buffer, BufferPos *p) {
if (p->block == 0)
return false;
--p->block;
+ p->index = buffer->blocks[p->block].len-1;
} else {
--p->index;
}
@@ -385,6 +386,7 @@ static bool buffer_pos_move_right(TextBuffer *buffer, BufferPos *p) {
if (p->block >= buffer->nblocks-1)
return false;
++p->block;
+ p->index = 0;
} else {
++p->index;
}