Skip to main content

Module edit

Module edit 

Source
Expand description

The per-file replacement engine behind ct-edit: a line-scoped find/replace that preserves every untouched byte (line terminators, indentation, and surrounding text) and records the changed lines.

Structs§

Site
One line that an edit changed, captured before/after for preview.

Functions§

edit_content
Apply re/replacement to one file’s content, per line, preserving line terminators and every untouched byte. Returns the new content, the number of occurrences replaced, and the changed lines. literal selects literal replacement (no $ capture expansion), used for literal/glob finds.