Batch edit fix

This commit is contained in:
Allen Webster 2019-03-22 13:08:06 -07:00
parent 2c381917fd
commit 1b4c95e4dd
1 changed files with 9 additions and 3 deletions

View File

@ -315,9 +315,15 @@ edit_single(System_Functions *system, Models *models, Editing_File *file, Edit e
// TODO(allen): this isn't "real" anymore, batch edits are now superseded a combination of other features, we should dump this someday // TODO(allen): this isn't "real" anymore, batch edits are now superseded a combination of other features, we should dump this someday
internal void internal void
edit_batch(System_Functions *system, Models *models, Editing_File *file, Edit_Array edits, Edit_Behaviors behaviors){ edit_batch(System_Functions *system, Models *models, Editing_File *file, Edit_Array edits, Edit_Behaviors behaviors){
Edit *edit = edits.vals; Edit *edit_ptr = edits.vals;
for (i32 i = 0; i < edits.count; i += 1, edit += 1){ i32 shift = 0;
edit_single(system, models, file, *edit, behaviors); for (i32 i = 0; i < edits.count; i += 1, edit_ptr += 1){
Edit edit = *edit_ptr;
i32 shift_change = edit.length - (edit.range.one_past_last - edit.range.first);
edit.range.first += shift;
edit.range.one_past_last += shift;
edit_single(system, models, file, edit, behaviors);
shift += shift_change;
} }
} }