diff --git a/buffer/4coder_buffer_abstract.cpp b/buffer/4coder_buffer_abstract.cpp index 66bfb829..4362c50d 100644 --- a/buffer/4coder_buffer_abstract.cpp +++ b/buffer/4coder_buffer_abstract.cpp @@ -529,6 +529,9 @@ buffer_cursor_seek(Buffer_Type *buffer, Buffer_Seek seek, f32 max_width, xy_seek = (seek.type == buffer_seek_wrapped_xy || seek.type == buffer_seek_unwrapped_xy); result = 1; + stream.use_termination_character = 1; + stream.terminator = 0; + if (buffer_stringify_loop(&stream, buffer, i, size)){ b32 still_looping = 0; do{ @@ -544,11 +547,7 @@ buffer_cursor_seek(Buffer_Type *buffer, Buffer_Seek seek, f32 max_width, }while(still_looping); } - if (result){ - result = cursor_seek_step(&state, seek, xy_seek, max_width, - font_height, adv, size, 0); - assert_4tech(result == 0); - } + assert_4tech(result == 0); } buffer_cursor_seek_end:; diff --git a/buffer/4coder_gap_buffer.cpp b/buffer/4coder_gap_buffer.cpp index da39d3a1..803b0e48 100644 --- a/buffer/4coder_gap_buffer.cpp +++ b/buffer/4coder_gap_buffer.cpp @@ -104,6 +104,9 @@ typedef struct Gap_Buffer_Stream{ i32 end; i32 separated; i32 absolute_end; + + b32 use_termination_character; + char terminator; } Gap_Buffer_Stream; internal_4tech b32 @@ -142,6 +145,17 @@ buffer_stringify_loop(Gap_Buffer_Stream *stream, Gap_Buffer *buffer, i32 start, result = 1; } + if (result == 0){ + if (stream->use_termination_character){ + stream->buffer = buffer; + stream->absolute_end = end; + stream->use_termination_character = 0; + stream->data = (&stream->terminator) - buffer->size1 - buffer->size2; + stream->end = stream->absolute_end + 1; + result = 1; + } + } + return(result); } @@ -155,6 +169,16 @@ buffer_stringify_next(Gap_Buffer_Stream *stream){ stream->separated = 0; result = 1; } + + if (result == 0){ + if (stream->use_termination_character){ + stream->use_termination_character = 0; + stream->data = (&stream->terminator) - buffer->size1 - buffer->size2; + stream->end = stream->absolute_end + 1; + result = 1; + } + } + return(result); }