From d2a0f86d9fd7c3795af397a0a6ad878f67c35bdd Mon Sep 17 00:00:00 2001 From: marynate Date: Thu, 15 Jan 2015 15:54:31 +0800 Subject: [PATCH] Only show Close Tab confirmation when script has unsaved change;Update Close Tab message to emphasize the fact script will be saved when closing tab;Stop dumping 'applying code' message to console --- tools/editor/plugins/script_editor_plugin.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index 55957887dcd..46255699026 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -188,7 +188,7 @@ void ScriptTextEditor::apply_code() { if (script.is_null()) return; - print_line("applying code"); +// print_line("applying code"); script->set_source_code(get_text_edit()->get_text()); script->update_exports(); } @@ -1033,9 +1033,12 @@ void ScriptEditor::_menu_option(int p_option) { editor->emit_signal("request_help", text); } break; case WINDOW_CLOSE: { - - erase_tab_confirm->set_text("Close Tab?:\n\""+current->get_name()+"\""); - erase_tab_confirm->popup_centered(Point2(250,80)); + if (current->get_text_edit()->get_version()!=current->get_text_edit()->get_saved_version()) { + erase_tab_confirm->set_text("Close and save changes?\n\""+current->get_name()+"\""); + erase_tab_confirm->popup_centered(Point2(250,80)); + } else { + _close_current_tab(); + } } break; case WINDOW_MOVE_LEFT: {