Repository navigation
Bug fixes:
- PatchApply, PatchSplitMax and PatchAddContext now slice text on UTF-8 rune boundaries. Patches built from or applied to text with multi-byte characters no longer panic with "slice bounds out of range" and always produce valid UTF-8 (#132, #155).
- Applying a patch to a text that has changed no longer panics when earlier edits leave the text shorter than the later insert and delete positions expect; positions are clamped to the text, as substring does in the reference implementation. This could panic on plain ASCII text.
- A patch whose context ends inside a multi-byte rune no longer places an insertion one rune early while still reporting success.
Behavior:
- PatchMake → PatchApply round trips are unchanged, including for multi-byte text. Applying a patch to a changed multi-byte text differs in ambiguous fuzzy-match cases, where previous releases produced invalid UTF-8 or panicked. Verified with a randomized differential comparison of half a million patch applications against v1.4.4: no panics, no invalid UTF-8, and identical round-trip and ASCII results.