From 0cbaa998ce3666285e543b9b1abfa8fa4764c446 Mon Sep 17 00:00:00 2001
From: Nathan Vegdahl <cessen@cessen.com>
Date: Tue, 22 Jun 2021 17:36:29 -0700
Subject: [PATCH] Fix flipped condition where Helix adds a line ending on open.

---
 helix-view/src/document.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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());
         }