Skip to content

Commit c6eeac7

Browse files
committed
len calculation
1 parent e614d50 commit c6eeac7

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
@@ -728,8 +728,8 @@ 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(deletion))/2 ||
732-
float64(overlapLength1) >= float64(len(insertion))/2 {
731+
if float64(overlapLength1) >= float64(len([]rune(deletion)))/2 ||
732+
float64(overlapLength1) >= float64(len([]rune(insertion)))/2 {
733733

734734
// Overlap found. Insert an equality and trim the surrounding edits.
735735
diffs = splice(diffs, pointer, 0, Diff{DiffEqual, insertion[:overlapLength1]})

0 commit comments

Comments
 (0)