sergi / go-diff

Diff, match and patch text in Go
MIT License
1.81k stars 207 forks source link

Fix for Index out of range panic in DiffCharsToLines on large diff #104

Closed r-pai closed 3 years ago

r-pai commented 4 years ago

This fix is for Issue#89 "Index out of range panic in DiffCharsToLines on large JSON diff".

Moved the index stored from rune to string array. Using delimeter "," the string array is combined to a string . This string is converted to rune array and returned for DiffLinesToRunes. DiffCharsToLines method, split the index string, which is the diff using the delimeter and then use the index to fetch data from linearray.

sergi commented 3 years ago

Integrated your code straight from your repo (keeping your authorship). Thanks a lot for contributing!