Refactor y cursor, add small utility for debugging, fix bug in buffer

This commit is contained in:
Krzosa Karol
2024-06-28 13:30:55 +02:00
parent b8cdb49ea5
commit 4dfa9b432e
2 changed files with 69 additions and 7 deletions

View File

@@ -249,8 +249,11 @@ void ApplyEdits(Buffer *buffer, Array<Edit> edits) {
#endif
// We need to sort from lowest to higest based on range.min
Array<Edit> edits_copy = edits.copy(scratch);
MergeSort(edits.len, edits_copy.data, edits.data);
{
Array<Edit> edits_copy = edits.copy(scratch);
MergeSort(edits.len, edits_copy.data, edits.data);
edits = edits_copy;
}
// Try resizing the buffers
int64_t len_offset = size_to_insert - size_to_delete;