diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs index f0d7b55a..d3c6cf9e 100644 --- a/helix-view/src/document.rs +++ b/helix-view/src/document.rs @@ -260,7 +260,7 @@ impl Document { let line_ending = auto_detect_line_ending(&doc).unwrap_or(DEFAULT_LINE_ENDING); // add missing newline at the end of file - if doc.len_bytes() == 0 || char_is_line_ending(doc.char(doc.len_chars() - 1)) { + if doc.len_bytes() == 0 || !char_is_line_ending(doc.char(doc.len_chars() - 1)) { doc.insert(doc.len_chars(), line_ending.as_str()); }