Skip to content

Commit 72a1ad4

Browse files
committed
-
1 parent 6895bfd commit 72a1ad4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

diffmatchpatch/diff.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -728,24 +728,24 @@ func (dmp *DiffMatchPatch) DiffCleanupSemantic(diffs []Diff) []Diff {
728728
overlapLength1 := dmp.DiffCommonOverlap(deletion, insertion)
729729
overlapLength2 := dmp.DiffCommonOverlap(insertion, deletion)
730730
if overlapLength1 >= overlapLength2 {
731-
if float64(overlapLength1) >= float64(len([]rune(deletion)))/2 ||
732-
float64(overlapLength1) >= float64(len([]rune(insertion)))/2 {
731+
if float64(overlapLength1) >= float64(len(deletion))/2 ||
732+
float64(overlapLength1) >= float64(len(insertion))/2 {
733733

734734
// Overlap found. Insert an equality and trim the surrounding edits.
735735
diffs = splice(diffs, pointer, 0, Diff{DiffEqual, insertion[:overlapLength1]})
736736
diffs[pointer-1].Text =
737-
deletion[0 : len([]rune(deletion))-overlapLength1]
737+
deletion[0 : len(deletion)-overlapLength1]
738738
diffs[pointer+1].Text = insertion[overlapLength1:]
739739
pointer++
740740
}
741741
} else {
742-
if float64(overlapLength2) >= float64(len([]rune(deletion)))/2 ||
743-
float64(overlapLength2) >= float64(len([]rune(insertion)))/2 {
742+
if float64(overlapLength2) >= float64(len(deletion))/2 ||
743+
float64(overlapLength2) >= float64(len(insertion))/2 {
744744
// Reverse overlap found. Insert an equality and swap and trim the surrounding edits.
745745
overlap := Diff{DiffEqual, deletion[:overlapLength2]}
746746
diffs = splice(diffs, pointer, 0, overlap)
747747
diffs[pointer-1].Type = DiffInsert
748-
diffs[pointer-1].Text = insertion[0 : len([]rune(insertion))-overlapLength2]
748+
diffs[pointer-1].Text = insertion[0 : len(insertion)-overlapLength2]
749749
diffs[pointer+1].Type = DiffDelete
750750
diffs[pointer+1].Text = deletion[overlapLength2:]
751751
pointer++

0 commit comments

Comments
 (0)