From 300ae1ba324b54190d118192a0aa210670ea267a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pa=CC=84vels=20Nadtoc=CC=8Cajevs?= <7645683+bruvzg@users.noreply.github.com> Date: Thu, 19 Mar 2026 20:31:12 +0200 Subject: [PATCH] [TextEdit] Ignore IME updates and Alt sequences when control is read-only. --- scene/gui/text_edit.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index cfb9138f20..d2ade4d4d9 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -1979,7 +1979,7 @@ void TextEdit::_notification(int p_what) { } break; case MainLoop::NOTIFICATION_OS_IME_UPDATE: { - if (has_focus()) { + if (has_focus() && editable) { const String &new_ime_text = DisplayServer::get_singleton()->ime_get_text(); const Vector2i &new_ime_selection = DisplayServer::get_singleton()->ime_get_selection(); if (ime_text == new_ime_text && ime_selection == new_ime_selection) { @@ -2064,6 +2064,9 @@ void TextEdit::unhandled_key_input(const Ref &p_event) { } bool TextEdit::alt_input(const Ref &p_gui_input) { + if (!editable) { + return false; + } Ref k = p_gui_input; if (k.is_valid()) { // Start Unicode Alt input (hold). @@ -3441,6 +3444,10 @@ void TextEdit::_update_ime_window_position() { if (wid == DisplayServerEnums::INVALID_WINDOW_ID || !DisplayServer::get_singleton()->has_feature(DisplayServerEnums::FEATURE_IME)) { return; } + if (!editable) { + DisplayServer::get_singleton()->window_set_ime_active(false, wid); + return; + } DisplayServer::get_singleton()->window_set_ime_active(true, wid); Point2 pos = get_global_position() + get_caret_draw_pos(); if (get_window()->get_embedder()) {