From dad3f27e9f58bf7fd44a0c420b2ea1c6558eba7a Mon Sep 17 00:00:00 2001 From: PouleyKetchoupp Date: Wed, 6 Jan 2021 11:31:44 -0700 Subject: [PATCH] Update String property field only when text has changed Avoids resetting the cursor position when the inspector updates while editing a string property. Fixes #42488 (cherry picked from commit c064378f954346c0e37252cf785878fe5c7bb633) --- editor/editor_properties.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index f52fe2514eb..d3a49cf2d3a 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -70,7 +70,9 @@ void EditorPropertyText::_text_changed(const String &p_string) { void EditorPropertyText::update_property() { String s = get_edited_object()->get(get_edited_property()); updating = true; - text->set_text(s); + if (text->get_text() != s) { + text->set_text(s); + } text->set_editable(!is_read_only()); updating = false; } @@ -125,9 +127,11 @@ void EditorPropertyMultilineText::_open_big_text() { void EditorPropertyMultilineText::update_property() { String t = get_edited_object()->get(get_edited_property()); - text->set_text(t); - if (big_text && big_text->is_visible_in_tree()) { - big_text->set_text(t); + if (text->get_text() != t) { + text->set_text(t); + if (big_text && big_text->is_visible_in_tree()) { + big_text->set_text(t); + } } }