PatchDeepCopy returns an array that is identical to a given an array of patches.
(patches []Patch)
| 263 | |
| 264 | // PatchDeepCopy returns an array that is identical to a given an array of patches. |
| 265 | func (dmp *DiffMatchPatch) PatchDeepCopy(patches []Patch) []Patch { |
| 266 | patchesCopy := []Patch{} |
| 267 | for _, aPatch := range patches { |
| 268 | patchCopy := Patch{} |
| 269 | for _, aDiff := range aPatch.diffs { |
| 270 | patchCopy.diffs = append(patchCopy.diffs, Diff{ |
| 271 | aDiff.Type, |
| 272 | aDiff.Text, |
| 273 | }) |
| 274 | } |
| 275 | patchCopy.Start1 = aPatch.Start1 |
| 276 | patchCopy.Start2 = aPatch.Start2 |
| 277 | patchCopy.Length1 = aPatch.Length1 |
| 278 | patchCopy.Length2 = aPatch.Length2 |
| 279 | patchesCopy = append(patchesCopy, patchCopy) |
| 280 | } |
| 281 | return patchesCopy |
| 282 | } |
| 283 | |
| 284 | // PatchApply merges a set of patches onto the text. Returns a patched text, as well as an array of true/false values indicating which patches were applied. |
| 285 | func (dmp *DiffMatchPatch) PatchApply(patches []Patch, text string) (string, []bool) { |
no outgoing calls