summaryrefslogtreecommitdiffstats
path: root/core/input
diff options
context:
space:
mode:
authorRedworkDE <10944644+RedworkDE@users.noreply.github.com>2023-05-09 15:50:48 +0200
committerRedworkDE <10944644+RedworkDE@users.noreply.github.com>2023-05-09 18:40:56 +0200
commit8e7afec479b29bfe7f6d33ca9bce70c9d1abf7cf (patch)
tree04bf8cc8c930f47c5793811aed5483b0fd7ff3bb /core/input
parent668cf3c66f42989949399f36e9faa29426e37416 (diff)
downloadredot-engine-8e7afec479b29bfe7f6d33ca9bce70c9d1abf7cf.tar.gz
Fix various errors when running the unit tests
Co-authored-by: bruvzg <7645683+bruvzg@users.noreply.github.com>
Diffstat (limited to 'core/input')
-rw-r--r--core/input/input_event.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/core/input/input_event.cpp b/core/input/input_event.cpp
index 46f07fe041..19e4d6182a 100644
--- a/core/input/input_event.cpp
+++ b/core/input/input_event.cpp
@@ -484,7 +484,10 @@ Ref<InputEventKey> InputEventKey::create_reference(Key p_keycode, bool p_physica
ie->set_keycode(p_keycode & KeyModifierMask::CODE_MASK);
}
- ie->set_unicode(char32_t(p_keycode & KeyModifierMask::CODE_MASK));
+ char32_t ch = char32_t(p_keycode & KeyModifierMask::CODE_MASK);
+ if (ch < 0xd800 || (ch > 0xdfff && ch <= 0x10ffff)) {
+ ie->set_unicode(ch);
+ }
if ((p_keycode & KeyModifierMask::SHIFT) != Key::NONE) {
ie->set_shift_pressed(true);