diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index a6336a6ad12..162f90665f7 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -1638,6 +1638,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 cfc0d3519f7..43fc487c598 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;