Skip to content

Commit

Permalink
Add [true] [false] and [null] tags to class reference
Browse files Browse the repository at this point in the history
  • Loading branch information
Mickeon committed Nov 19, 2024
1 parent fd4c29a commit c91b6ba
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions editor/editor_help.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2616,6 +2616,25 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt, const C
p_rt->pop(); // font

pos = brk_end + 1;

} else if (tag == "true" || tag == "false" || tag == "null") {
// Use monospace font with darkened background color to make code easier to distinguish from other text.
String link_target = (tag == null ? "Variant" : "bool" );

p_rt->push_font(doc_bold_font);
p_rt->push_font_size(doc_code_font_size);
p_rt->push_bgcolor(code_bg_color);
p_rt->push_color(code_color.lerp(p_owner_node->get_theme_color(SNAME("error_color"), EditorStringName(Editor)), 0.6));
p_rt->push_meta("@class " + link_target, underline_mode);

p_rt->add_text(tag);

p_rt->pop(); // color
p_rt->pop(); // bgcolor
p_rt->pop(); // font_size
p_rt->pop(); // font

pos += (tag == "false" ? 5 : 4); // `len("false")` and `len("true")`.
} else if (tag == "b") {
// Use bold font.
p_rt->push_font(doc_bold_font);
Expand Down

0 comments on commit c91b6ba

Please sign in to comment.