From e4181c6d483ca7d5eb38dba76842136f86d70b5e Mon Sep 17 00:00:00 2001 From: Mateus Reis Date: Fri, 22 Dec 2023 23:42:24 +0200 Subject: [PATCH] Fix double text_changed signal when overwriting selection in LineEdit The part of gui_input that handles unicode wasn't checking text_changed_dirty before emitting the signal, unlike the rest of the text editing functions. Fixes #86451 (cherry picked from commit cab48493d848c93ae8fa3b5843a4a24d782a1189) --- scene/gui/line_edit.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index 5ed1a9d5e3a..4a6fd174f36 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -624,7 +624,12 @@ void LineEdit::gui_input(const Ref &p_event) { int prev_len = text.length(); insert_text_at_caret(ucodestr); if (text.length() != prev_len) { - _text_changed(); + if (!text_changed_dirty) { + if (is_inside_tree()) { + callable_mp(this, &LineEdit::_text_changed).call_deferred(); + } + text_changed_dirty = true; + } } accept_event(); return;