summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
authorHaoyu Qiu <timothyqiu32@gmail.com>2022-04-05 09:12:10 +0800
committerHaoyu Qiu <timothyqiu32@gmail.com>2022-04-05 09:12:10 +0800
commit8cefbfcf432ef6ed3879ee60bf500b52149f3e01 (patch)
tree702fcb87682a4b45121edf332677bde42dcd2030 /scene/gui
parent3ffe7004ddb56697dbf661786b996dafa98bc89e (diff)
Consider chained operation when selecting text in TextEdit::undo()
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/text_edit.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 1bed72c907..1f49491eb8 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -3486,9 +3486,6 @@ void TextEdit::undo() {
TextOperation op = undo_stack_pos->get();
_do_text_op(op, true);
- if (op.type != TextOperation::TYPE_INSERT && (op.from_line != op.to_line || op.to_column != op.from_column + 1)) {
- select(op.from_line, op.from_column, op.to_line, op.to_column);
- }
current_op.version = op.prev_version;
if (undo_stack_pos->get().chain_backward) {
@@ -3504,6 +3501,10 @@ void TextEdit::undo() {
}
}
+ if (op.type != TextOperation::TYPE_INSERT && (op.from_line != op.to_line || op.to_column != op.from_column + 1)) {
+ select(op.from_line, op.from_column, op.to_line, op.to_column);
+ }
+
_update_scrollbars();
if (undo_stack_pos->get().type == TextOperation::TYPE_REMOVE) {
set_caret_line(undo_stack_pos->get().to_line, false);