Skip to content

Commit dcde5a4

Browse files
roryflynnzimmski
authored andcommitted
Fixed rare issue with DiffCleanupSemantic
Output was mangled for very specific phrases. Python version produced clean output. Go version fixed to be the same as Python version.
1 parent 17df971 commit dcde5a4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

diffmatchpatch/dmp.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,7 @@ func (dmp *DiffMatchPatch) DiffCleanupSemantic(diffs []Diff) []Diff {
967967
float64(overlapLength2) >= float64(len(insertion))/2 {
968968
// Reverse overlap found.
969969
// Insert an equality and swap and trim the surrounding edits.
970-
overlap := Diff{DiffEqual, insertion[len(insertion)-overlapLength2:]}
970+
overlap := Diff{DiffEqual, deletion[:overlapLength2]}
971971
diffs = append(
972972
diffs[:pointer],
973973
append([]Diff{overlap}, diffs[pointer:]...)...)

0 commit comments

Comments
 (0)