summaryrefslogtreecommitdiffstats
path: root/editor/editor_help.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-03-09 22:20:19 +0100
committerRémi Verschelde <rverschelde@gmail.com>2024-03-09 22:20:19 +0100
commit7d6ae138fa7064270ee61fed747a11780c2f1c0f (patch)
tree869c52c84809f2d8e0878f6ad41ff1d2c5352890 /editor/editor_help.cpp
parentf45207bbf2d455ff6e16f0cafbe5b03220490c1c (diff)
parent4f61d42a001636f80dcc9cfd119f6da01f28e4cd (diff)
downloadredot-engine-7d6ae138fa7064270ee61fed747a11780c2f1c0f.tar.gz
Merge pull request #89332 from Riteo/werror-never-changes
Fix compiler warning when highlighting codeblocks in editor help
Diffstat (limited to 'editor/editor_help.cpp')
-rw-r--r--editor/editor_help.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index 8c55c45190..022cf82426 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -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