diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 95d9173d399..f9946bf4bb0 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -2141,9 +2141,12 @@ void TextEdit::_gui_input(const Ref &p_gui_input) { if (completion_index > 0) { completion_index--; - completion_current = completion_options[completion_index]; - update(); + } else { + completion_index = completion_options.size() - 1; } + completion_current = completion_options[completion_index]; + update(); + accept_event(); return; } @@ -2152,9 +2155,12 @@ void TextEdit::_gui_input(const Ref &p_gui_input) { if (completion_index < completion_options.size() - 1) { completion_index++; - completion_current = completion_options[completion_index]; - update(); + } else { + completion_index = 0; } + completion_current = completion_options[completion_index]; + update(); + accept_event(); return; }