diff options
author | Matheus Lima Cunha <matheus.limacunha@hotmail.com> | 2019-05-28 18:27:32 -0300 |
---|---|---|
committer | Matheus Lima Cunha <matheus.limacunha@hotmail.com> | 2019-05-29 18:13:29 -0300 |
commit | 7fbb6d986ffe6101af1e062daeb9e1aa203684a6 (patch) | |
tree | 7062d63f37b3dd58f9a817e6577d4dbf59652edd /editor/plugins/script_editor_plugin.cpp | |
parent | 06e580f5ba801cf524b1d82753127a9992c7b907 (diff) | |
download | redot-engine-7fbb6d986ffe6101af1e062daeb9e1aa203684a6.tar.gz |
Automatically add new line to scripts
Diffstat (limited to 'editor/plugins/script_editor_plugin.cpp')
-rw-r--r-- | editor/plugins/script_editor_plugin.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index d7d4cec07d..98242ec76d 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -681,6 +681,8 @@ void ScriptEditor::_resave_scripts(const String &p_str) { se->trim_trailing_whitespace(); } + se->insert_final_newline(); + if (convert_indent_on_save) { if (use_space_indentation) { se->convert_indent_to_spaces(); @@ -1033,6 +1035,8 @@ void ScriptEditor::_menu_option(int p_option) { if (trim_trailing_whitespace_on_save) current->trim_trailing_whitespace(); + current->insert_final_newline(); + if (convert_indent_on_save) { if (use_space_indentation) { current->convert_indent_to_spaces(); @@ -1052,7 +1056,10 @@ void ScriptEditor::_menu_option(int p_option) { } break; case FILE_SAVE_AS: { - current->trim_trailing_whitespace(); + if (trim_trailing_whitespace_on_save) + current->trim_trailing_whitespace(); + + current->insert_final_newline(); if (convert_indent_on_save) { if (use_space_indentation) { @@ -2046,6 +2053,8 @@ void ScriptEditor::save_all_scripts() { se->trim_trailing_whitespace(); } + se->insert_final_newline(); + if (!se->is_unsaved()) continue; |