diff options
Diffstat (limited to 'editor/plugins/editor_preview_plugins.cpp')
-rw-r--r-- | editor/plugins/editor_preview_plugins.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp index cef505181a..7e0019faac 100644 --- a/editor/plugins/editor_preview_plugins.cpp +++ b/editor/plugins/editor_preview_plugins.cpp @@ -462,10 +462,6 @@ EditorMaterialPreviewPlugin::~EditorMaterialPreviewPlugin() { /////////////////////////////////////////////////////////////////////////// -static bool _is_text_char(char32_t c) { - return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '_'; -} - bool EditorScriptPreviewPlugin::handles(const String &p_type) const { return ClassDB::is_parent_class(p_type, "Script"); } @@ -538,15 +534,15 @@ Ref<Texture2D> EditorScriptPreviewPlugin::generate(const RES &p_from, const Size if (in_comment) { color = comment_color; } else { - if (c != '_' && ((c >= '!' && c <= '/') || (c >= ':' && c <= '@') || (c >= '[' && c <= '`') || (c >= '{' && c <= '~') || c == '\t')) { + if (is_symbol(c)) { //make symbol a little visible color = symbol_color; in_control_flow_keyword = false; in_keyword = false; - } else if (!prev_is_text && _is_text_char(c)) { + } else if (!prev_is_text && is_ascii_identifier_char(c)) { int pos = i; - while (_is_text_char(code[pos])) { + while (is_ascii_identifier_char(code[pos])) { pos++; } String word = code.substr(i, pos - i); @@ -556,7 +552,7 @@ Ref<Texture2D> EditorScriptPreviewPlugin::generate(const RES &p_from, const Size in_keyword = true; } - } else if (!_is_text_char(c)) { + } else if (!is_ascii_identifier_char(c)) { in_keyword = false; } @@ -571,7 +567,7 @@ Ref<Texture2D> EditorScriptPreviewPlugin::generate(const RES &p_from, const Size img->set_pixel(col, y0 + line * 2, bg_color.blend(ul)); img->set_pixel(col, y0 + line * 2 + 1, color); - prev_is_text = _is_text_char(c); + prev_is_text = is_ascii_identifier_char(c); } col++; } else { |