diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 0e8e0d60b21..b70a359b463 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -3748,8 +3748,13 @@ void TextEdit::undo() { } } - cursor_set_line(undo_stack_pos->get().from_line); - cursor_set_column(undo_stack_pos->get().from_column); + 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); + } else { + cursor_set_line(undo_stack_pos->get().from_line); + cursor_set_column(undo_stack_pos->get().from_column); + } update(); }