diff options
Diffstat (limited to 'editor/plugins/script_editor_plugin.cpp')
-rw-r--r-- | editor/plugins/script_editor_plugin.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index c48af90622..459a93c449 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -1007,6 +1007,10 @@ void ScriptEditor::_resave_scripts(const String &p_str) { se->trim_trailing_whitespace(); } + if (trim_final_newlines_on_save) { + se->trim_final_newlines(); + } + se->insert_final_newline(); if (convert_indent_on_save) { @@ -1387,6 +1391,10 @@ void ScriptEditor::_menu_option(int p_option) { current->trim_trailing_whitespace(); } + if (trim_final_newlines_on_save) { + current->trim_final_newlines(); + } + current->insert_final_newline(); if (convert_indent_on_save) { @@ -2567,6 +2575,10 @@ void ScriptEditor::save_current_script() { current->trim_trailing_whitespace(); } + if (trim_final_newlines_on_save) { + current->trim_final_newlines(); + } + current->insert_final_newline(); if (convert_indent_on_save) { @@ -2611,6 +2623,10 @@ void ScriptEditor::save_all_scripts() { se->trim_trailing_whitespace(); } + if (trim_final_newlines_on_save) { + se->trim_final_newlines(); + } + se->insert_final_newline(); if (!se->is_unsaved()) { @@ -2848,6 +2864,7 @@ void ScriptEditor::_apply_editor_settings() { } trim_trailing_whitespace_on_save = EDITOR_GET("text_editor/behavior/files/trim_trailing_whitespace_on_save"); + trim_final_newlines_on_save = EDITOR_GET("text_editor/behavior/files/trim_final_newlines_on_save"); convert_indent_on_save = EDITOR_GET("text_editor/behavior/files/convert_indent_on_save"); members_overview_enabled = EDITOR_GET("text_editor/script_list/show_members_overview"); @@ -4265,6 +4282,7 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) { edit_pass = 0; trim_trailing_whitespace_on_save = EDITOR_GET("text_editor/behavior/files/trim_trailing_whitespace_on_save"); + trim_final_newlines_on_save = EDITOR_GET("text_editor/behavior/files/trim_final_newlines_on_save"); convert_indent_on_save = EDITOR_GET("text_editor/behavior/files/convert_indent_on_save"); ScriptServer::edit_request_func = _open_script_request; |