Handle tab in TextEdit

This commit is contained in:
Paulb23 2022-10-09 17:46:40 +01:00
parent 880a0177d1
commit 7333aa68f4
2 changed files with 23 additions and 2 deletions

View file

@ -2192,8 +2192,17 @@ void TextEdit::gui_input(const Ref<InputEvent> &p_gui_input) {
return;
}
// Handle Unicode (if no modifiers active). Tab has a value of 0x09.
if (allow_unicode_handling && editable && (k->get_unicode() >= 32 || k->get_keycode() == Key::TAB)) {
// Handle tab as it has no set unicode value.
if (k->is_action("ui_text_indent", true)) {
if (editable) {
insert_text_at_caret("\t");
}
accept_event();
return;
}
// Handle Unicode (if no modifiers active).
if (allow_unicode_handling && editable && k->get_unicode() >= 32) {
handle_unicode_input(k->get_unicode());
accept_event();
return;