Mercurial > octave
comparison libgui/src/m-editor/file-editor-tab.cc @ 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 | b8a38ed00bf4 |
comparison
equal
deleted
inserted
replaced
28141:33d89d314d43 | 28142:908bdd05398a |
---|---|
2311 out.setCodec (codec); | 2311 out.setCodec (codec); |
2312 | 2312 |
2313 QApplication::setOverrideCursor (Qt::WaitCursor); | 2313 QApplication::setOverrideCursor (Qt::WaitCursor); |
2314 | 2314 |
2315 out << m_edit_area->text (); | 2315 out << m_edit_area->text (); |
2316 if (settings->value (ed_force_newline).toBool ()) | 2316 if (settings->value (ed_force_newline).toBool () |
2317 && m_edit_area->text ().length ()) | |
2317 out << eol_string (); // Add newline if desired | 2318 out << eol_string (); // Add newline if desired |
2318 | 2319 |
2319 out.flush (); | 2320 out.flush (); |
2320 QApplication::restoreOverrideCursor (); | 2321 QApplication::restoreOverrideCursor (); |
2321 file.flush (); | 2322 file.flush (); |