changeset 28142:908bdd05398a

do not add a newline on empty editor files (bug #57861) * file-editor-tab.cc (do_save_file): also check file length before adding a newline while saving the file
author Torsten Lilge <ttl-octave@mailbox.org>
date Fri, 28 Feb 2020 07:08:14 +0100
parents 33d89d314d43
children 27c0b26e5a9f
files libgui/src/m-editor/file-editor-tab.cc
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor-tab.cc	Thu Feb 27 23:22:30 2020 +0100
+++ b/libgui/src/m-editor/file-editor-tab.cc	Fri Feb 28 07:08:14 2020 +0100
@@ -2313,7 +2313,8 @@
     QApplication::setOverrideCursor (Qt::WaitCursor);
 
     out << m_edit_area->text ();
-    if (settings->value (ed_force_newline).toBool ())
+    if (settings->value (ed_force_newline).toBool ()
+        && m_edit_area->text ().length ())
       out << eol_string ();   // Add newline if desired
 
     out.flush ();