diff options
author | Paulb23 <p_batty@hotmail.co.uk> | 2022-10-09 17:46:40 +0100 |
---|---|---|
committer | Paulb23 <p_batty@hotmail.co.uk> | 2022-10-09 17:46:40 +0100 |
commit | 7333aa68f4fbc8a47dc7d3076acc13898aad97aa (patch) | |
tree | ca36a4550dcb8ffe62b87ba20a7ffff569b9dece /scene/gui | |
parent | 880a0177d12463b612268afe95bd3d8dd565bf52 (diff) |
Handle tab in TextEdit
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/text_edit.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index f8501f3570..0e769c5b0c 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -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; |