Merge pull request #86460 from reach-satori/double_textchanged_emit

Fix double `text_changed` signal when overwriting selection in LineEdit
This commit is contained in:
Rémi Verschelde 2024-01-03 15:47:03 +01:00
commit 5042f543ab
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -624,7 +624,12 @@ void LineEdit::gui_input(const Ref<InputEvent> &p_event) {
int prev_len = text.length(); int prev_len = text.length();
insert_text_at_caret(ucodestr); insert_text_at_caret(ucodestr);
if (text.length() != prev_len) { 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(); accept_event();
return; return;