Browse Source

Don't emit text_changed signal when clearing empty LineEdit

kobewi 9 months ago
parent
commit
b8b1584f5a
1 changed files with 5 additions and 1 deletions
  1. 5 1
      scene/gui/line_edit.cpp

+ 5 - 1
scene/gui/line_edit.cpp

@@ -1853,8 +1853,12 @@ Array LineEdit::get_structured_text_bidi_override_options() const {
 }
 }
 
 
 void LineEdit::clear() {
 void LineEdit::clear() {
+	bool was_empty = text.is_empty();
 	clear_internal();
 	clear_internal();
-	_text_changed();
+	_clear_redo();
+	if (!was_empty) {
+		_emit_text_change();
+	}
 
 
 	// This should reset virtual keyboard state if needed.
 	// This should reset virtual keyboard state if needed.
 	if (editing) {
 	if (editing) {