DiffCharsToLines rehydrates the text in a diff from a string of line hashes to real lines of text.
(diffs []Diff, lineArray []string)
| 406 | |
| 407 | // DiffCharsToLines rehydrates the text in a diff from a string of line hashes to real lines of text. |
| 408 | func (dmp *DiffMatchPatch) DiffCharsToLines(diffs []Diff, lineArray []string) []Diff { |
| 409 | hydrated := make([]Diff, 0, len(diffs)) |
| 410 | for _, aDiff := range diffs { |
| 411 | runes := []rune(aDiff.Text) |
| 412 | text := make([]string, len(runes)) |
| 413 | |
| 414 | for i, r := range runes { |
| 415 | text[i] = lineArray[runeToInt(r)] |
| 416 | } |
| 417 | |
| 418 | aDiff.Text = strings.Join(text, "") |
| 419 | hydrated = append(hydrated, aDiff) |
| 420 | } |
| 421 | return hydrated |
| 422 | } |
| 423 | |
| 424 | // DiffCommonPrefix determines the common prefix length of two strings. |
| 425 | func (dmp *DiffMatchPatch) DiffCommonPrefix(text1, text2 string) int { |