소스 검색

Fix TextEditor not checking Standard highlighter in non-English UI

When using non-English UI, there were `Index p_idx = -1 is out of bounds (items.size() = 2).`
errors on on startup if any text file is open in the script editor. And clicking the Standard
highlighter option does not check that menu item.

This is caused by `TextEditor` searching for that menu item with unlocalized text. As already
did in `ScriptTextEditor`, this PR stores and searches for menu item with `TTR`ed text.

(cherry picked from commit a66339a5497ad72e0c52c70c6c50a9b0fb72b2df)
Haoyu Qiu 4 년 전
부모
커밋
dff81b25cd
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      editor/plugins/text_editor.cpp

+ 2 - 2
editor/plugins/text_editor.cpp

@@ -44,7 +44,7 @@ void TextEditor::set_syntax_highlighter(SyntaxHighlighter *p_highlighter) {
 	if (p_highlighter != NULL) {
 		highlighter_menu->set_item_checked(highlighter_menu->get_item_idx_from_text(p_highlighter->get_name()), true);
 	} else {
-		highlighter_menu->set_item_checked(highlighter_menu->get_item_idx_from_text("Standard"), true);
+		highlighter_menu->set_item_checked(highlighter_menu->get_item_idx_from_text(TTR("Standard")), true);
 	}
 
 	// little work around. GDScript highlighter goes through text_edit for colours,
@@ -700,7 +700,7 @@ TextEditor::TextEditor() {
 	convert_case->add_shortcut(ED_SHORTCUT("script_text_editor/capitalize", TTR("Capitalize")), EDIT_CAPITALIZE);
 	convert_case->connect("id_pressed", this, "_edit_option");
 
-	highlighters["Standard"] = NULL;
+	highlighters[TTR("Standard")] = NULL;
 	highlighter_menu = memnew(PopupMenu);
 	highlighter_menu->set_name("highlighter_menu");
 	edit_menu->get_popup()->add_child(highlighter_menu);