diff options
author | Riteo <riteo@posteo.net> | 2024-03-09 20:51:30 +0100 |
---|---|---|
committer | Riteo <riteo@posteo.net> | 2024-03-09 22:00:35 +0100 |
commit | 4f61d42a001636f80dcc9cfd119f6da01f28e4cd (patch) | |
tree | 7fcb90936ae15f580905b599eaf2cc3082fe9da4 /editor/editor_help.cpp | |
parent | f28964805e44a5c068ce8fd9d1e00697fcd922dc (diff) | |
download | redot-engine-4f61d42a001636f80dcc9cfd119f6da01f28e4cd.tar.gz |
Fix compiler warning when highlighting codeblocks in editor help
It's more verbose but it should do the trick.
Diffstat (limited to 'editor/editor_help.cpp')
-rw-r--r-- | editor/editor_help.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index 598db3cc78..600a517120 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -2618,20 +2618,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 |