diff options
| author | Paulb23 | 2016-04-05 15:50:54 +0100 |
|---|---|---|
| committer | Rémi Verschelde | 2016-06-04 22:20:02 +0200 |
| commit | 86c0438f9d8c51688353445c4f9e566a87afd204 (patch) | |
| tree | 3d6d7cfbb366165dbefb44f53509cde435473d8d /scene/gui/text_edit.cpp | |
| parent | d7e4fb4365cbbd8b17f386ed515a82575981788a (diff) | |
| download | godot-86c0438f9d8c51688353445c4f9e566a87afd204.tar.gz godot-86c0438f9d8c51688353445c4f9e566a87afd204.tar.zst godot-86c0438f9d8c51688353445c4f9e566a87afd204.zip | |
Member variable syntax highlighting
(cherry picked from commit fc9f9adcb25cde432f888b8b29aee862eb0d8f95)
Diffstat (limited to 'scene/gui/text_edit.cpp')
| -rw-r--r-- | scene/gui/text_edit.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 317f8edcf..b5956cdb9 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -672,6 +672,7 @@ void TextEdit::_notification(int p_what) { bool in_keyword=false; bool in_word = false; bool in_function_name = false; + bool in_member_variable = false; Color keyword_color; // check if line contains highlighted word @@ -801,14 +802,28 @@ void TextEdit::_notification(int p_what) { } } + if (!in_function_name && !in_member_variable && !in_keyword && !is_number && in_word) { + int k = j; + while(k > 0 && !_is_symbol(str[k]) && str[k] != '\t' && str[k] != ' ') { + k--; + } + + if (str[k] == '.') { + in_member_variable = true; + } + } + if (is_symbol) { in_function_name = false; + in_member_variable = false; } if (in_region>=0) color=color_regions[in_region].color; else if (in_keyword) color=keyword_color; + else if (in_member_variable) + color=cache.member_variable_color; else if (in_function_name) color=cache.function_color; else if (is_symbol) @@ -3151,6 +3166,7 @@ void TextEdit::_update_caches() { cache.font_selected_color=get_color("font_selected_color"); cache.keyword_color=get_color("keyword_color"); cache.function_color=get_color("function_color"); + cache.member_variable_color=get_color("member_variable_color"); cache.number_color=get_color("number_color"); cache.selection_color=get_color("selection_color"); cache.mark_color=get_color("mark_color"); |
