summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2016-04-06 18:42:13 +0200
committerRémi Verschelde <remi@verschelde.fr>2016-04-06 18:42:13 +0200
commitd6871ee847524aea3648095196fa726d52480db2 (patch)
tree1f8f492a4ac32e578dde59f31312562f0f1605a6 /scene/gui
parentaad31ee986e60183c708f0c6d31cc04e05f31916 (diff)
parentfc9f9adcb25cde432f888b8b29aee862eb0d8f95 (diff)
Merge pull request #4234 from Paulb23/member_variable_syntax_highlighting
Member variable syntax highlighting
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/text_edit.cpp16
-rw-r--r--scene/gui/text_edit.h1
2 files changed, 17 insertions, 0 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index d48b8995eb..a0dd26b3a6 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
@@ -803,14 +804,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)
@@ -3049,6 +3064,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");
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index 467c49f51b..95cb9b1405 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -78,6 +78,7 @@ class TextEdit : public Control {
Color keyword_color;
Color number_color;
Color function_color;
+ Color member_variable_color;
Color selection_color;
Color mark_color;
Color breakpoint_color;