diff options
| author | Bojidar Marinov | 2017-11-15 22:53:08 +0200 |
|---|---|---|
| committer | Bojidar Marinov | 2017-11-15 22:53:08 +0200 |
| commit | 443ce6fef2ff2115b90d1929d33788fb2afe2636 (patch) | |
| tree | e6a835c360cbafbf46933da846b91342e33a7c00 /scene/gui/text_edit.cpp | |
| parent | 6277e6d40a0f0e8c84470482400959fca4ff5ad8 (diff) | |
| download | godot-443ce6fef2ff2115b90d1929d33788fb2afe2636.tar.gz godot-443ce6fef2ff2115b90d1929d33788fb2afe2636.tar.zst godot-443ce6fef2ff2115b90d1929d33788fb2afe2636.zip | |
Allow underscores in GDScript numeric literals
Closes #12928
Diffstat (limited to '')
| -rw-r--r-- | scene/gui/text_edit.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 5d429f9f9..6da34cd26 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -894,17 +894,18 @@ void TextEdit::_notification(int p_what) { is_hex_notation = false; } - // check for dot or 'x' for hex notation in floating point number - if ((str[j] == '.' || str[j] == 'x') && !in_word && prev_is_number && !is_number) { + // check for dot or underscore or 'x' for hex notation in floating point number + if ((str[j] == '.' || str[j] == 'x' || str[j] == '_') && !in_word && prev_is_number && !is_number) { is_number = true; is_symbol = false; + is_char = false; if (str[j] == 'x' && str[j - 1] == '0') { is_hex_notation = true; } } - if (!in_word && _is_char(str[j])) { + if (!in_word && _is_char(str[j]) && !is_number) { in_word = true; } |
