Skip to main content

remove_block_bytewise

Function remove_block_bytewise 

Source
pub fn remove_block_bytewise(content: &str, sentinel: &Sentinel<'_>) -> String
Expand description

Byte-offset block removal (shells::profile’s semantics).

No-op if either marker is missing. When present, consumes one preceding blank line (a literal "\n\n" tail immediately before the start marker) and the trailing newline immediately after the end marker, if present.

On CRLF input, neither the preceding blank line nor the trailing newline is consumed: the checks look for a literal "\n\n" tail / leading '\n', which a "\r\n" sequence doesn’t satisfy. CRLF bytes elsewhere in content are left untouched (this function never rewrites line endings).