aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Marques2016-06-13 16:40:28 -0300
committerGeorge Marques2016-06-19 11:43:47 -0300
commit831ae2d510b4ae87a1ff5f828ab817640269dca2 (patch)
treec9cdd14405a29dc331e5c995f7e409ec4ecfa50f
parentd3dff93e33bb61bde1cc8c311c38c3ba356b2c7f (diff)
downloadgodot-831ae2d510b4ae87a1ff5f828ab817640269dca2.tar.gz
godot-831ae2d510b4ae87a1ff5f828ab817640269dca2.tar.zst
godot-831ae2d510b4ae87a1ff5f828ab817640269dca2.zip
Fix TextEdit cursor position after undo remove text
It was going to where the text started, now it goes to where the text ends.
Diffstat (limited to '')
-rw-r--r--scene/gui/text_edit.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index c08247095..5774b02be 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -3837,8 +3837,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();
}