The function ensure_final_newline in buffer.rs has this explanation: Ensures that the buffer ends with a single newline character, no other whitespace. The documentation wasn't explaining well that we actually remove any lines containing only whitespace and keep only 1 line at the end of a buffer. Release Notes: - N/A --------- Co-authored-by: Peter Tripp <peter@zed.dev> Co-authored-by: Danilo Leal <danilo@zed.dev>