1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-28 16:07:14 +00:00

[IME] Do not redraw and move caret on IME update w/o text/position changes.

This commit is contained in:
Pāvels Nadtočajevs
2025-02-20 08:23:22 +02:00
parent 70eb62faf2
commit 84a2e3fdb0
2 changed files with 16 additions and 4 deletions

View File

@@ -1377,8 +1377,14 @@ void LineEdit::_notification(int p_what) {
case MainLoop::NOTIFICATION_OS_IME_UPDATE: { case MainLoop::NOTIFICATION_OS_IME_UPDATE: {
if (editing) { if (editing) {
ime_text = DisplayServer::get_singleton()->ime_get_text(); const String &new_ime_text = DisplayServer::get_singleton()->ime_get_text();
ime_selection = DisplayServer::get_singleton()->ime_get_selection(); const Vector2i &new_ime_selection = DisplayServer::get_singleton()->ime_get_selection();
if (ime_text == new_ime_text && ime_selection == new_ime_selection) {
break;
}
ime_text = new_ime_text;
ime_selection = new_ime_selection;
if (!ime_text.is_empty()) { if (!ime_text.is_empty()) {
selection_delete(); selection_delete();

View File

@@ -1633,9 +1633,15 @@ void TextEdit::_notification(int p_what) {
case MainLoop::NOTIFICATION_OS_IME_UPDATE: { case MainLoop::NOTIFICATION_OS_IME_UPDATE: {
if (has_focus()) { if (has_focus()) {
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) {
break;
}
bool had_ime_text = has_ime_text(); bool had_ime_text = has_ime_text();
ime_text = DisplayServer::get_singleton()->ime_get_text(); ime_text = new_ime_text;
ime_selection = DisplayServer::get_singleton()->ime_get_selection(); ime_selection = new_ime_selection;
if (!had_ime_text && has_ime_text()) { if (!had_ime_text && has_ime_text()) {
_cancel_drag_and_drop_text(); _cancel_drag_and_drop_text();