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

Merge pull request #32796 from Paulb23/set_text_caret

Changed `set_text` to place caret at start of the text.
Rémi Verschelde 5 жил өмнө
parent
commit
78848bbfea

+ 6 - 0
scene/gui/text_edit.cpp

@@ -4762,6 +4762,9 @@ void TextEdit::set_text(String p_text) {
 		selection.active = false;
 	}
 
+	cursor_set_line(0);
+	cursor_set_column(0);
+
 	update();
 	setting_text = false;
 };
@@ -6037,6 +6040,7 @@ void TextEdit::undo() {
 		}
 	}
 
+	_update_scrollbars();
 	if (undo_stack_pos->get().type == TextOperation::TYPE_REMOVE) {
 		cursor_set_line(undo_stack_pos->get().to_line);
 		cursor_set_column(undo_stack_pos->get().to_column);
@@ -6072,6 +6076,8 @@ void TextEdit::redo() {
 				break;
 		}
 	}
+
+	_update_scrollbars();
 	cursor_set_line(undo_stack_pos->get().to_line);
 	cursor_set_column(undo_stack_pos->get().to_column);
 	undo_stack_pos = undo_stack_pos->next();