From 8eca52fc76576624732aa60fc894964aea15494a Mon Sep 17 00:00:00 2001 From: Relintai Date: Tue, 21 Feb 2023 13:14:09 +0100 Subject: [PATCH] Ported: Fix highlight color for class attributes that are also keywords. - lucasvanmol https://github.com/godotengine/godot/commit/749d0c708c1c12bdb168fd5ff762c6ff5799fcde --- modules/gdscript/editor/gdscript_highlighter.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/modules/gdscript/editor/gdscript_highlighter.cpp b/modules/gdscript/editor/gdscript_highlighter.cpp index 3bbab1145..5388c53d2 100644 --- a/modules/gdscript/editor/gdscript_highlighter.cpp +++ b/modules/gdscript/editor/gdscript_highlighter.cpp @@ -275,19 +275,22 @@ Dictionary GDScriptSyntaxHighlighter::_get_line_syntax_highlighting(int p_line) col = keywords[word]; } else if (member_keywords.has(word)) { col = member_keywords[word]; + } + + if (col != Color()) { for (int k = j - 1; k >= 0; k--) { if (str[k] == '.') { - col = Color(); //member indexing not allowed + col = Color(); // keyword & member indexing not allowed break; } else if (str[k] > 32) { break; } } - } - if (col != Color()) { - in_keyword = true; - keyword_color = col; + if (col != Color()) { + in_keyword = true; + keyword_color = col; + } } }