Skip to main content

Module line_endings

Module line_endings 

Source
Expand description

Line-ending-agnostic comparison helpers.

Preset templates are embedded and written LF (see the repo .gitattributes), but a user’s on-disk copy of an installed file may be CRLF — e.g. a Windows editor re-saving a PowerShell profile. Comparing those byte-exact would treat a pure CRLF↔LF difference as a real change, producing spurious “update” reports (and silent whole-file rewrites) on re-install. These helpers let the reconciliation logic compare content while ignoring line-ending style.

Functions§

eol_eq
Compares two byte slices for equality, ignoring line-ending style (\r\n, lone \r, and \n are all treated as equivalent line breaks).
normalize_eol
Returns a copy of bytes with every \r\n and lone \r reduced to \n.