@@ -746,15 +746,14 @@ fn diffCleanupMerge(diffs: std.ArrayListUnmanaged(Diff), allocator: mem.Allocato
746746 }
747747 // Delete the offending records and add the merged ones.
748748 pointer -= count_delete + count_insert ;
749- Splice (diffs , pointer , count_delete + count_insert );
750- // diffs.insertSlice(allocator, pointer, items: []const T)
749+ try diffs .replaceRange (allocator , pointer , count_delete + count_insert , &.{});
751750
752751 if (text_delete .items .len != 0 ) {
753- Splice ( diffs , pointer , 0 , Diff { .operation = .delete , .text = text_delete });
752+ try diffs . replaceRange ( allocator , pointer , 0 , &.{ Diff { .operation = .delete , .text = text_delete } });
754753 pointer += 1 ;
755754 }
756755 if (text_insert .Length != 0 ) {
757- diffs .Splice ( pointer , 0 , Diff { .operation = .insert , .text = text_insert });
756+ try diffs .replaceRange ( allocator , pointer , 0 , &.{ Diff { .operation = .insert , .text = text_insert } });
758757 pointer += 1 ;
759758 }
760759 pointer += 1 ;
@@ -793,14 +792,14 @@ fn diffCleanupMerge(diffs: std.ArrayListUnmanaged(Diff), allocator: mem.Allocato
793792 diffs [pointer ].text .Substring (0 , diffs [pointer ].text .Length -
794793 diffs [pointer - 1 ].text .Length );
795794 diffs [pointer + 1 ].text = diffs [pointer - 1 ].text + diffs [pointer + 1 ].text ;
796- diffs .Splice ( pointer - 1 , 1 );
795+ try diffs .replaceRange ( allocator , pointer - 1 , 1 , &.{} );
797796 changes = true ;
798797 } else if (mem .startsWith (u8 , diffs [pointer ].text .items , diffs [pointer + 1 ].text .items )) {
799798 // Shift the edit over the next equality.
800799 diffs [pointer - 1 ].text += diffs [pointer + 1 ].text ;
801800 diffs [pointer ].text =
802801 diffs [pointer ].text .Substring (diffs [pointer + 1 ].text .Length ) + diffs [pointer + 1 ].text ;
803- diffs .Splice ( pointer + 1 , 1 );
802+ try diffs .replaceRange ( allocator , pointer + 1 , 1 , &.{} );
804803 changes = true ;
805804 }
806805 }
0 commit comments