Use a fixed-width font for internal references in the editor help
Since internal references are often written in scripts, it makes sense to use a fixed-width font for them.
This commit is contained in:
parent
e33f8df9ca
commit
357e7e8f9f
1 changed files with 8 additions and 4 deletions
|
@ -1352,24 +1352,28 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) {
|
||||||
pos = brk_pos + 1;
|
pos = brk_pos + 1;
|
||||||
|
|
||||||
} else if (tag.begins_with("method ") || tag.begins_with("member ") || tag.begins_with("signal ") || tag.begins_with("enum ") || tag.begins_with("constant ")) {
|
} else if (tag.begins_with("method ") || tag.begins_with("member ") || tag.begins_with("signal ") || tag.begins_with("enum ") || tag.begins_with("constant ")) {
|
||||||
int tag_end = tag.find(" ");
|
const int tag_end = tag.find(" ");
|
||||||
|
const String link_tag = tag.substr(0, tag_end);
|
||||||
String link_tag = tag.substr(0, tag_end);
|
const String link_target = tag.substr(tag_end + 1, tag.length()).lstrip(" ");
|
||||||
String link_target = tag.substr(tag_end + 1, tag.length()).lstrip(" ");
|
|
||||||
|
|
||||||
|
p_rt->push_font(doc_code_font);
|
||||||
p_rt->push_color(link_color);
|
p_rt->push_color(link_color);
|
||||||
p_rt->push_meta("@" + link_tag + " " + link_target);
|
p_rt->push_meta("@" + link_tag + " " + link_target);
|
||||||
p_rt->add_text(link_target + (tag.begins_with("method ") ? "()" : ""));
|
p_rt->add_text(link_target + (tag.begins_with("method ") ? "()" : ""));
|
||||||
p_rt->pop();
|
p_rt->pop();
|
||||||
p_rt->pop();
|
p_rt->pop();
|
||||||
|
p_rt->pop();
|
||||||
pos = brk_end + 1;
|
pos = brk_end + 1;
|
||||||
|
|
||||||
} else if (doc->class_list.has(tag)) {
|
} else if (doc->class_list.has(tag)) {
|
||||||
|
// Class reference tag such as [Node2D] or [SceneTree].
|
||||||
|
p_rt->push_font(doc_code_font);
|
||||||
p_rt->push_color(link_color);
|
p_rt->push_color(link_color);
|
||||||
p_rt->push_meta("#" + tag);
|
p_rt->push_meta("#" + tag);
|
||||||
p_rt->add_text(tag);
|
p_rt->add_text(tag);
|
||||||
p_rt->pop();
|
p_rt->pop();
|
||||||
p_rt->pop();
|
p_rt->pop();
|
||||||
|
p_rt->pop();
|
||||||
pos = brk_end + 1;
|
pos = brk_end + 1;
|
||||||
|
|
||||||
} else if (tag == "b") {
|
} else if (tag == "b") {
|
||||||
|
|
Loading…
Reference in a new issue