Skip to content

Commit e614d50

Browse files
committed
len calculation
1 parent 066c0e6 commit e614d50

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

diffmatchpatch/diff.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -739,8 +739,8 @@ func (dmp *DiffMatchPatch) DiffCleanupSemantic(diffs []Diff) []Diff {
739739
pointer++
740740
}
741741
} else {
742-
if float64(overlapLength2) >= float64(len(deletion))/2 ||
743-
float64(overlapLength2) >= float64(len(insertion))/2 {
742+
if float64(overlapLength2) >= float64(len([]rune(deletion)))/2 ||
743+
float64(overlapLength2) >= float64(len([]rune(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)

0 commit comments

Comments
 (0)