Skip to main content

Module edit

Module edit 

Source
Expand description

The edit tool: several replacements in one file per call, applied in order, each to the text the ones before it left, and all of them or none. A byte-order mark and CRLF line endings are kept. Text that does not match exactly may still match line by line once trailing whitespace and typographic quotes, dashes and spaces are evened out, but only where exactly one place in the file matches. The result names the lines that now hold the changed text and shows them, with a few lines around each, as the file now holds them; a failure says what to send instead, with the closest text to an old_text that was not found.

Structs§

Applied
What apply makes of a file’s text.
Edit
Replaces text in a file. Publishes the file it changed (FilesChanged): its resolved path, and the whole diff.
EditArgs
Arguments of Edit.
Replacement

Functions§

apply
Makes edits to text, the whole text of the file at path, exactly as Edit does, without touching the file: each edit is matched, exactly or loosely, against the text the edits before it left, and all are applied or none. A byte-order mark and CRLF line endings are kept. path names the file in the FileChange and in an error.