Mercurial > octave
changeset 28141:33d89d314d43
prevent removing all spaces instead of trailing ones (bug #57861)
* file-editor-tab.cc (eol_string): return an end of file string in any case;
(handle_save_file_as_answer, handle_save_file_as_answer_close):
remove use of uninitialzed variables that were used when the eol mode
was configurable while saving the file
author | Torsten Lilge <ttl-octave@mailbox.org> |
---|---|
date | Thu, 27 Feb 2020 23:22:30 +0100 |
parents | e82d00e8be37 |
children | 908bdd05398a |
files | libgui/src/m-editor/file-editor-tab.cc |
diffstat | 1 files changed, 2 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor-tab.cc Wed Feb 26 13:29:01 2020 -0500 +++ b/libgui/src/m-editor/file-editor-tab.cc Thu Feb 27 23:22:30 2020 +0100 @@ -2018,7 +2018,8 @@ return ("\n"); } - return QString (); + // Last resort, if the above goes wrong (should never happen) + return ("\r\n"); } void file_editor_tab::update_eol_indicator (void) @@ -2532,9 +2533,6 @@ void file_editor_tab::handle_save_file_as_answer (const QString& saveFileName) { - if (m_save_as_desired_eol != m_edit_area->eolMode ()) - convert_eol (this,m_save_as_desired_eol); - if (saveFileName == m_file_name) { save_file (saveFileName); @@ -2551,13 +2549,6 @@ void file_editor_tab::handle_save_file_as_answer_close (const QString& saveFileName) { - if (m_save_as_desired_eol != m_edit_area->eolMode ()) - { - m_edit_area->setReadOnly (false); // was set to read-only in save_file_as - convert_eol (this,m_save_as_desired_eol); - m_edit_area->setReadOnly (true); // restore read-only mode - } - // saveFileName == m_file_name can not happen, because we only can get here // when we close a tab and m_file_name is not a valid filename yet