Skip to content

Commit 7d6ae13

Browse files
committed
Merge pull request #89332 from Riteo/werror-never-changes
Fix compiler warning when highlighting codeblocks in editor help
2 parents f45207b + 4f61d42 commit 7d6ae13

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
@@ -2622,20 +2622,25 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt, Control
26222622
p_rt->set_cell_padding(Rect2(10 * EDSCALE, 10 * EDSCALE, 10 * EDSCALE, 10 * EDSCALE));
26232623
p_rt->push_color(code_dark_color);
26242624

2625-
if (lang.is_empty() || lang == "gdscript") {
2625+
bool codeblock_printed = false;
2626+
26262627
#ifdef MODULE_GDSCRIPT_ENABLED
2628+
if (!codeblock_printed && (lang.is_empty() || lang == "gdscript")) {
26272629
EditorHelpHighlighter::get_singleton()->highlight(p_rt, EditorHelpHighlighter::LANGUAGE_GDSCRIPT, codeblock_text, is_native);
2628-
#else
2629-
p_rt->add_text(codeblock_text);
2630+
codeblock_printed = true;
2631+
}
26302632
#endif
2631-
} else if (lang == "csharp") {
2633+
26322634
#ifdef MODULE_MONO_ENABLED
2635+
if (!codeblock_printed && lang == "csharp") {
26332636
EditorHelpHighlighter::get_singleton()->highlight(p_rt, EditorHelpHighlighter::LANGUAGE_CSHARP, codeblock_text, is_native);
2634-
#else
2635-
p_rt->add_text(codeblock_text);
2637+
codeblock_printed = true;
2638+
}
26362639
#endif
2637-
} else {
2640+
2641+
if (!codeblock_printed) {
26382642
p_rt->add_text(codeblock_text);
2643+
codeblock_printed = true;
26392644
}
26402645

26412646
p_rt->pop(); // color

0 commit comments

Comments
 (0)