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
This commit is contained in:
parent
f62f64193a
commit
c064378f95
1 changed files with 8 additions and 4 deletions
|
@ -77,7 +77,9 @@ void EditorPropertyText::_text_changed(const String &p_string) {
|
||||||
void EditorPropertyText::update_property() {
|
void EditorPropertyText::update_property() {
|
||||||
String s = get_edited_object()->get(get_edited_property());
|
String s = get_edited_object()->get(get_edited_property());
|
||||||
updating = true;
|
updating = true;
|
||||||
|
if (text->get_text() != s) {
|
||||||
text->set_text(s);
|
text->set_text(s);
|
||||||
|
}
|
||||||
text->set_editable(!is_read_only());
|
text->set_editable(!is_read_only());
|
||||||
updating = false;
|
updating = false;
|
||||||
}
|
}
|
||||||
|
@ -133,10 +135,12 @@ void EditorPropertyMultilineText::_open_big_text() {
|
||||||
|
|
||||||
void EditorPropertyMultilineText::update_property() {
|
void EditorPropertyMultilineText::update_property() {
|
||||||
String t = get_edited_object()->get(get_edited_property());
|
String t = get_edited_object()->get(get_edited_property());
|
||||||
|
if (text->get_text() != t) {
|
||||||
text->set_text(t);
|
text->set_text(t);
|
||||||
if (big_text && big_text->is_visible_in_tree()) {
|
if (big_text && big_text->is_visible_in_tree()) {
|
||||||
big_text->set_text(t);
|
big_text->set_text(t);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorPropertyMultilineText::_notification(int p_what) {
|
void EditorPropertyMultilineText::_notification(int p_what) {
|
||||||
|
|
Loading…
Reference in a new issue