Skip to content

Commit 4f61d42

Browse files
committed
Fix compiler warning when highlighting codeblocks in editor help
It's more verbose but it should do the trick.
1 parent f289648 commit 4f61d42

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

editor/editor_help.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2618,20 +2618,25 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt, Control
26182618
p_rt->set_cell_padding(Rect2(10 * EDSCALE, 10 * EDSCALE, 10 * EDSCALE, 10 * EDSCALE));
26192619
p_rt->push_color(code_dark_color);
26202620

2621-
if (lang.is_empty() || lang == "gdscript") {
2621+
bool codeblock_printed = false;
2622+
26222623
#ifdef MODULE_GDSCRIPT_ENABLED
2624+
if (!codeblock_printed && (lang.is_empty() || lang == "gdscript")) {
26232625
EditorHelpHighlighter::get_singleton()->highlight(p_rt, EditorHelpHighlighter::LANGUAGE_GDSCRIPT, codeblock_text, is_native);
2624-
#else
2625-
p_rt->add_text(codeblock_text);
2626+
codeblock_printed = true;
2627+
}
26262628
#endif
2627-
} else if (lang == "csharp") {
2629+
26282630
#ifdef MODULE_MONO_ENABLED
2631+
if (!codeblock_printed && lang == "csharp") {
26292632
EditorHelpHighlighter::get_singleton()->highlight(p_rt, EditorHelpHighlighter::LANGUAGE_CSHARP, codeblock_text, is_native);
2630-
#else
2631-
p_rt->add_text(codeblock_text);
2633+
codeblock_printed = true;
2634+
}
26322635
#endif
2633-
} else {
2636+
2637+
if (!codeblock_printed) {
26342638
p_rt->add_text(codeblock_text);
2639+
codeblock_printed = true;
26352640
}
26362641

26372642
p_rt->pop(); // color

0 commit comments

Comments
 (0)