From 7247247522dd390ee54c75fcd5f604c4ab30e94b Mon Sep 17 00:00:00 2001 From: "Andrii Doroshenko (Xrayez)" Date: Thu, 23 Jul 2020 15:21:28 +0300 Subject: [PATCH] Make unsaved scripts in the script editor more user-friendly Unsaved scripts were previously displayed with blank tabs, which are mostly a result of deleted or improperly moved scripts. This patch makes sure that those kind of scripts are displayed as "[unsaved]" now, and ensures that scripts are removed from the list while deleting scripts from the filesystem dock preventing the unsaved tabs to appear in the first place (a user is already prompted with "no undo" warning while deleting any file). A user is always prompted to save those "[unsaved]" scripts if they attempt to close them without saving in any case except as described above. --- editor/plugins/script_editor_plugin.cpp | 48 ++++++++++++++++--- editor/plugins/script_editor_plugin.h | 2 + editor/plugins/script_text_editor.cpp | 8 +++- editor/plugins/text_editor.cpp | 8 +++- .../visual_script/visual_script_editor.cpp | 9 +++- 5 files changed, 65 insertions(+), 10 deletions(-) diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 6b844ec0d0a..756444097d3 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -699,15 +699,18 @@ void ScriptEditor::_close_tab(int p_idx, bool p_save, bool p_history_back) { ScriptEditorBase *current = Object::cast_to(tselected); if (current) { Ref