Merge pull request #89332 from Riteo/werror-never-changes

Fix compiler warning when highlighting codeblocks in editor help
This commit is contained in:
Rémi Verschelde 2024-03-09 22:20:19 +01:00
commit 7d6ae138fa
No known key found for this signature in database
GPG Key ID: C3336907360768E1

View File

@ -2622,20 +2622,25 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt, Control
p_rt->set_cell_padding(Rect2(10 * EDSCALE, 10 * EDSCALE, 10 * EDSCALE, 10 * EDSCALE));
p_rt->push_color(code_dark_color);
if (lang.is_empty() || lang == "gdscript") {
bool codeblock_printed = false;
#ifdef MODULE_GDSCRIPT_ENABLED
if (!codeblock_printed && (lang.is_empty() || lang == "gdscript")) {
EditorHelpHighlighter::get_singleton()->highlight(p_rt, EditorHelpHighlighter::LANGUAGE_GDSCRIPT, codeblock_text, is_native);
#else
p_rt->add_text(codeblock_text);
codeblock_printed = true;
}
#endif
} else if (lang == "csharp") {
#ifdef MODULE_MONO_ENABLED
if (!codeblock_printed && lang == "csharp") {
EditorHelpHighlighter::get_singleton()->highlight(p_rt, EditorHelpHighlighter::LANGUAGE_CSHARP, codeblock_text, is_native);
#else
p_rt->add_text(codeblock_text);
codeblock_printed = true;
}
#endif
} else {
if (!codeblock_printed) {
p_rt->add_text(codeblock_text);
codeblock_printed = true;
}
p_rt->pop(); // color