You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Cleanup and move char functions to the char_utils.h header.
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user