Browse Source

Merge pull request #1225 from marynate/PR-script-editor-close-tab

Only show Close Tab confirmation when script has unsaved change
Juan Linietsky 10 năm trước cách đây
mục cha
commit
be7d8a182c
1 tập tin đã thay đổi với 7 bổ sung4 xóa
  1. 7 4
      tools/editor/plugins/script_editor_plugin.cpp

+ 7 - 4
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();
 }
@@ -1034,9 +1034,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: {