You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-06 12:20:30 +00:00
Fix class_desc_deselect handling of @GlobalScope.X links
Fix bug where links to class enums and class constants of the form @GlobalScope.X were broken. For an enum or constant with name "example_name", links of both forms @GlobalScope.example_name and example_name will now be correctly handled, including where example_name contains "." (e.g. Variant.Type).
This commit is contained in:
@@ -127,30 +127,35 @@ void EditorHelp::_class_desc_select(const String &p_select) {
|
|||||||
if (table->has(link)) {
|
if (table->has(link)) {
|
||||||
// Found in the current page.
|
// Found in the current page.
|
||||||
class_desc->scroll_to_paragraph((*table)[link]);
|
class_desc->scroll_to_paragraph((*table)[link]);
|
||||||
} else if (topic == "class_enum") {
|
} else {
|
||||||
// Try to find the enum in @GlobalScope.
|
// Look for link in @GlobalScope.
|
||||||
|
// Note that a link like @GlobalScope.enum_name will not be found in this section, only enum_name will be.
|
||||||
|
if (topic == "class_enum") {
|
||||||
const DocData::ClassDoc &cd = doc->class_list["@GlobalScope"];
|
const DocData::ClassDoc &cd = doc->class_list["@GlobalScope"];
|
||||||
|
|
||||||
for (int i = 0; i < cd.constants.size(); i++) {
|
for (int i = 0; i < cd.constants.size(); i++) {
|
||||||
if (cd.constants[i].enumeration == link) {
|
if (cd.constants[i].enumeration == link) {
|
||||||
// Found in @GlobalScope.
|
// Found in @GlobalScope.
|
||||||
emit_signal(SNAME("go_to_help"), topic + ":@GlobalScope:" + link);
|
emit_signal(SNAME("go_to_help"), topic + ":@GlobalScope:" + link);
|
||||||
break;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (topic == "class_constant") {
|
} else if (topic == "class_constant") {
|
||||||
// Try to find the constant in @GlobalScope.
|
|
||||||
const DocData::ClassDoc &cd = doc->class_list["@GlobalScope"];
|
const DocData::ClassDoc &cd = doc->class_list["@GlobalScope"];
|
||||||
|
|
||||||
for (int i = 0; i < cd.constants.size(); i++) {
|
for (int i = 0; i < cd.constants.size(); i++) {
|
||||||
if (cd.constants[i].name == link) {
|
if (cd.constants[i].name == link) {
|
||||||
// Found in @GlobalScope.
|
// Found in @GlobalScope.
|
||||||
emit_signal(SNAME("go_to_help"), topic + ":@GlobalScope:" + link);
|
emit_signal(SNAME("go_to_help"), topic + ":@GlobalScope:" + link);
|
||||||
break;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (link.contains(".")) {
|
}
|
||||||
emit_signal(SNAME("go_to_help"), topic + ":" + link.get_slice(".", 0) + ":" + link.get_slice(".", 1));
|
|
||||||
|
if (link.contains(".")) {
|
||||||
|
int class_end = link.find(".");
|
||||||
|
emit_signal(SNAME("go_to_help"), topic + ":" + link.substr(0, class_end) + ":" + link.substr(class_end + 1, link.length()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (p_select.begins_with("http")) {
|
} else if (p_select.begins_with("http")) {
|
||||||
OS::get_singleton()->shell_open(p_select);
|
OS::get_singleton()->shell_open(p_select);
|
||||||
|
|||||||
Reference in New Issue
Block a user