Skip to main content

normalise_final_newline

Function normalise_final_newline 

fn normalise_final_newline(page: &str) -> String
Expand description

Ends a page with exactly one newline.

This is the one byte of a pragma page that framing-preservation does not leave to the author, and closing it was M7.D8’s job (docs/design/11-documentation-plan.md §1.3.38). The blind spot was that splice copies the framing — the final newline included — from the file on disk, so a page whose last byte had been stripped produced expected bytes that were also missing it, and --mode check compared them equal. check and write agreed, so nothing was ever inconsistent; a byte of formatting was simply unenforced, and a text file without its final newline is the kind of thing every diff tool complains about and no gate noticed. Normalising here means write fixes it and check reports it as drift on the last line.