aboutsummaryrefslogtreecommitdiff
path: root/editor/editor_help.cpp
diff options
context:
space:
mode:
authorRémi Verschelde2018-04-03 22:43:07 +0200
committerGitHub2018-04-03 22:43:07 +0200
commit82c26f74ad63ac68288f0e2e936cf02a5bd1f513 (patch)
tree01327ac7af3fee5b3ef2c5e1bb367a3e7b864437 /editor/editor_help.cpp
parenta7dd698d4d0c46c777c87681d9d20c1a3bb7101e (diff)
parent7d5a40c3e6fbd90f02ae677fc20300c3f38772df (diff)
downloadgodot-82c26f74ad63ac68288f0e2e936cf02a5bd1f513.tar.gz
godot-82c26f74ad63ac68288f0e2e936cf02a5bd1f513.tar.zst
godot-82c26f74ad63ac68288f0e2e936cf02a5bd1f513.zip
Merge pull request #17865 from delftswa2018/enumLookupFix
Ctrl+Clicking a enum now scrolls down to it in the docs.
Diffstat (limited to 'editor/editor_help.cpp')
-rw-r--r--editor/editor_help.cpp27
1 files changed, 23 insertions, 4 deletions
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index 7f76cf1af..f3be02a8c 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -1172,7 +1172,12 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
class_desc->push_indent(1);
Vector<DocData::ConstantDoc> enum_list = E->get();
+ Map<String, int> enumValuesContainer;
+ int enumStartingLine = enum_line[E->key()];
+
for (int i = 0; i < enum_list.size(); i++) {
+ if (cd.name == "@GlobalScope")
+ enumValuesContainer[enum_list[i].name] = enumStartingLine;
class_desc->push_font(doc_code_font);
class_desc->push_color(headline_color);
@@ -1200,6 +1205,9 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
class_desc->add_newline();
}
+ if (cd.name == "@GlobalScope")
+ enum_values_line[E->key()] = enumValuesContainer;
+
class_desc->pop();
class_desc->add_newline();
@@ -1485,21 +1493,32 @@ void EditorHelp::_help_callback(const String &p_topic) {
if (method_line.has(name))
line = method_line[name];
} else if (what == "class_property") {
-
if (property_line.has(name))
line = property_line[name];
} else if (what == "class_enum") {
-
if (enum_line.has(name))
line = enum_line[name];
} else if (what == "class_theme_item") {
-
if (theme_property_line.has(name))
line = theme_property_line[name];
} else if (what == "class_constant") {
-
if (constant_line.has(name))
line = constant_line[name];
+ } else if (what == "class_global") {
+ if (constant_line.has(name))
+ line = constant_line[name];
+ else {
+ Map<String, Map<String, int> >::Element *iter = enum_values_line.front();
+ while (true) {
+ if (iter->value().has(name)) {
+ line = iter->value()[name];
+ break;
+ } else if (iter == enum_values_line.back())
+ break;
+ else
+ iter = iter->next();
+ }
+ }
}
class_desc->call_deferred("scroll_to_line", line);