diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2017-11-16 09:04:31 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-16 09:04:31 +0100 |
commit | 3002130a6d3ab0a00d3e7538283d7f468becd8fa (patch) | |
tree | 09f7a95aa893c88ffe0102ac04c369b3dd2f7a17 /scene/gui | |
parent | dc463e1e42ac919d99d763c0127436877fc4efc5 (diff) | |
parent | 443ce6fef2ff2115b90d1929d33788fb2afe2636 (diff) |
Merge pull request #12957 from bojidar-bg/12928-numeric-underscores
Allow underscores in GDScript numeric literals
Diffstat (limited to 'scene/gui')
-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 5d429f9f91..6da34cd263 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; } |