File tree 1 file changed +9
-4
lines changed
1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -560,12 +560,17 @@ Dictionary GDScriptSyntaxHighlighter::_get_line_syntax_highlighting_impl(int p_l
560
560
}
561
561
}
562
562
563
- // Keep symbol color for binary '&&'. In the case of '&&&' use StringName color for the last ampersand .
563
+ // Set color of StringName, keeping symbol color for binary '&&' and '&' .
564
564
if (!in_string_name && in_region == -1 && str[j] == ' &' && !is_binary_op) {
565
- if (j >= 2 && str[j - 1 ] == ' &' && str[j - 2 ] != ' &' && prev_is_binary_op) {
566
- is_binary_op = true ;
567
- } else if (j == 0 || (j > 0 && str[j - 1 ] != ' &' ) || prev_is_binary_op) {
565
+ if (j + 1 <= line_length - 1 && (str[j + 1 ] == ' \' ' || str[j + 1 ] == ' "' )) {
568
566
in_string_name = true ;
567
+ // Cover edge cases of i.e. '+&""' and '&&&""', so the StringName is properly colored.
568
+ if (prev_is_binary_op && j >= 2 && str[j - 1 ] == ' &' && str[j - 2 ] != ' &' ) {
569
+ in_string_name = false ;
570
+ is_binary_op = true ;
571
+ }
572
+ } else {
573
+ is_binary_op = true ;
569
574
}
570
575
} else if (in_region != -1 || is_a_symbol) {
571
576
in_string_name = false ;
You can’t perform that action at this time.
0 commit comments