fixed cursor seek control flow so that the step is just in one spot again
parent
28b6132be5
commit
e2bb11ad8d
|
@ -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);
|
xy_seek = (seek.type == buffer_seek_wrapped_xy || seek.type == buffer_seek_unwrapped_xy);
|
||||||
result = 1;
|
result = 1;
|
||||||
|
|
||||||
|
stream.use_termination_character = 1;
|
||||||
|
stream.terminator = 0;
|
||||||
|
|
||||||
if (buffer_stringify_loop(&stream, buffer, i, size)){
|
if (buffer_stringify_loop(&stream, buffer, i, size)){
|
||||||
b32 still_looping = 0;
|
b32 still_looping = 0;
|
||||||
do{
|
do{
|
||||||
|
@ -544,12 +547,8 @@ buffer_cursor_seek(Buffer_Type *buffer, Buffer_Seek seek, f32 max_width,
|
||||||
}while(still_looping);
|
}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:;
|
buffer_cursor_seek_end:;
|
||||||
return(state.cursor);
|
return(state.cursor);
|
||||||
|
|
|
@ -104,6 +104,9 @@ typedef struct Gap_Buffer_Stream{
|
||||||
i32 end;
|
i32 end;
|
||||||
i32 separated;
|
i32 separated;
|
||||||
i32 absolute_end;
|
i32 absolute_end;
|
||||||
|
|
||||||
|
b32 use_termination_character;
|
||||||
|
char terminator;
|
||||||
} Gap_Buffer_Stream;
|
} Gap_Buffer_Stream;
|
||||||
|
|
||||||
internal_4tech b32
|
internal_4tech b32
|
||||||
|
@ -142,6 +145,17 @@ buffer_stringify_loop(Gap_Buffer_Stream *stream, Gap_Buffer *buffer, i32 start,
|
||||||
result = 1;
|
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);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,6 +169,16 @@ buffer_stringify_next(Gap_Buffer_Stream *stream){
|
||||||
stream->separated = 0;
|
stream->separated = 0;
|
||||||
result = 1;
|
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);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue