From 39f9b92f545113fe9ea3ad82e846fde6ace2bf70 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Sun, 9 May 2021 12:29:50 +0200 Subject: Save the current script when pressing Ctrl + S if no scene is open - Tweak the dialog messages to be more informative. - The "Saved N modified resources" dialog is not a warning per se, so make it more explicit. --- editor/plugins/script_editor_plugin.cpp | 112 ++++++++++++++++---------------- 1 file changed, 56 insertions(+), 56 deletions(-) (limited to 'editor/plugins/script_editor_plugin.cpp') diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index adfeead33b..8c4c5a3461 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -703,7 +703,7 @@ void ScriptEditor::_close_tab(int p_idx, bool p_save, bool p_history_back) { // Do not try to save internal scripts, but prompt to save in-memory // scripts which are not saved to disk yet (have empty path). if (script->get_path().find("local://") == -1 && script->get_path().find("::") == -1) { - _save_current_script(); + save_current_script(); } } if (script.is_valid()) { @@ -1101,59 +1101,6 @@ bool ScriptEditor::is_scripts_panel_toggled() { return list_split->is_visible(); } -void ScriptEditor::_save_current_script() { - ScriptEditorBase *current = _get_current_editor(); - - if (_test_script_times_on_disk()) { - return; - } - - 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(); - } else { - current->convert_indent_to_tabs(); - } - } - - RES resource = current->get_edited_resource(); - Ref text_file = resource; - Ref