Skip to main content

normalize

Function normalize 

Source
pub fn normalize(text: &str, shape: Shape) -> String
Expand description

The line breaks a field of this shape is allowed to hold.

CRLF is folded to LF whatever the shape: shape_text splits on \n alone, so a surviving \r shapes as a glyph and puts every offset after it out by one. A single-line field then keeps the text but not the breaks — a pasted newline becomes a space rather than silently truncating what was pasted.

The invariant this buys: a Shape::Line field’s content never contains a newline, so nothing downstream has to ask whether it might.