Edits are spliced into the original text, so lines the edit did not touch
keep their CRLF, LF or lone CR endings. The diff and patch are computed
before the file is written, so a failure there, such as running out of
memory on a large file, leaves the file unchanged.
fixes#8544