diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2020-11-29 18:47:08 -0500 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2020-11-29 18:47:08 -0500 |
commit | 7c0d13f907043728b75af73824be6fdf066458d2 (patch) | |
tree | f066804fe5c1e11e9577d9f9d8328fbd95191b6c /buffer.c | |
parent | c4fdc35b3b21faecda42e434b28e4fb6db39d3e6 (diff) |
oops fix cursor moving
Diffstat (limited to 'buffer.c')
-rw-r--r-- | buffer.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -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; } |