2
0
Эх сурвалжийг харах

Fix TextOp setting to none when typing

Paulb23 4 жил өмнө
parent
commit
7926d75d02

+ 7 - 2
scene/gui/text_edit.cpp

@@ -2731,7 +2731,10 @@ void TextEdit::insert_line_at(int p_at, const String &p_text) {
 }
 }
 
 
 void TextEdit::insert_text_at_caret(const String &p_text) {
 void TextEdit::insert_text_at_caret(const String &p_text) {
-	begin_complex_operation();
+	bool had_selection = has_selection();
+	if (had_selection) {
+		begin_complex_operation();
+	}
 
 
 	delete_selection();
 	delete_selection();
 
 
@@ -2743,7 +2746,9 @@ void TextEdit::insert_text_at_caret(const String &p_text) {
 	set_caret_column(new_column);
 	set_caret_column(new_column);
 	update();
 	update();
 
 
-	end_complex_operation();
+	if (had_selection) {
+		end_complex_operation();
+	}
 }
 }
 
 
 void TextEdit::remove_text(int p_from_line, int p_from_column, int p_to_line, int p_to_column) {
 void TextEdit::remove_text(int p_from_line, int p_from_column, int p_to_line, int p_to_column) {