Merge pull request #32796 from Paulb23/set_text_caret

Changed `set_text` to place caret at start of the text.
This commit is contained in:
Rémi Verschelde 2019-10-22 22:44:12 +02:00 committed by GitHub
commit 78848bbfea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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();