diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index fe0c018281f..99d98d5cc5b 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -1646,6 +1646,9 @@ void LineEdit::_notification(int p_what) { if (ime_text == new_ime_text && ime_selection == new_ime_selection) { break; } + if (!window_has_focus && !new_ime_text.is_empty()) { + break; + } ime_text = new_ime_text; ime_selection = new_ime_selection; diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index f4a53f68422..f97c217e64f 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -1978,6 +1978,9 @@ void TextEdit::_notification(int p_what) { if (ime_text == new_ime_text && ime_selection == new_ime_selection) { break; } + if (!window_has_focus && !new_ime_text.is_empty()) { + break; + } bool had_ime_text = has_ime_text(); ime_text = new_ime_text;