From 6f8113721d1025feb720bbcb163fb497c8b99972 Mon Sep 17 00:00:00 2001 From: "ocean (they/them)" Date: Fri, 28 Apr 2023 06:49:24 -0400 Subject: [PATCH] Fix wrongly removing prefix when generating in-editor documentation Co-authored-by: Danil Alexeev --- editor/editor_help.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index f2d852cc2b22..8d95a5b579d1 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -115,7 +115,13 @@ static String _contextualize_class_specifier(const String &p_class_specifier, co return p_class_specifier.substr(rfind + 1); } - // Remove prefix + // They share a _name_ prefix but not a _class specifier_ prefix, e.g. Tree & TreeItem + // begins_with + lengths being different implies p_class_specifier.length() > p_edited_class.length() so this is safe + if (p_class_specifier[p_edited_class.length()] != '.') { + return p_class_specifier; + } + + // Remove class specifier prefix return p_class_specifier.substr(p_edited_class.length() + 1); }