Skip to content

Commit

Permalink
fixing indicies when using myers algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
yazgazan committed Jul 5, 2018
1 parent 5d69ec8 commit f8fcfc7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions diff/slice.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ func myersToDiff(conf config, lhs, rhs reflect.Value, changes []myersdiff.Change
res = append(res, sliceMissing{lhs.Index(lhsIdx + d).Interface()})
indices = append(indices, lhsIdx+d)
}
lhsIdx += c.Del
for i := 0; i < c.Ins; i++ {
res = append(res, sliceExcess{rhs.Index(rhsIdx + i).Interface()})
indices = append(indices, rhsIdx+i)
indices = append(indices, lhsIdx+i)
}
lhsIdx += c.Del
rhsIdx += c.Ins
}

Expand Down

0 comments on commit f8fcfc7

Please # to comment.