Skip to content

Commit f8fcfc7

Browse files
committed
fixing indicies when using myers algorithm
1 parent 5d69ec8 commit f8fcfc7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

diff/slice.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ func myersToDiff(conf config, lhs, rhs reflect.Value, changes []myersdiff.Change
6060
res = append(res, sliceMissing{lhs.Index(lhsIdx + d).Interface()})
6161
indices = append(indices, lhsIdx+d)
6262
}
63-
lhsIdx += c.Del
6463
for i := 0; i < c.Ins; i++ {
6564
res = append(res, sliceExcess{rhs.Index(rhsIdx + i).Interface()})
66-
indices = append(indices, rhsIdx+i)
65+
indices = append(indices, lhsIdx+i)
6766
}
67+
lhsIdx += c.Del
6868
rhsIdx += c.Ins
6969
}
7070

0 commit comments

Comments
 (0)