mirror of
https://github.com/godotengine/godot.git
synced 2024-12-15 10:12:40 +08:00
Merge pull request #59897 from timothyqiu/undo-select
Consider chained operation when selecting text in `TextEdit::undo()`
This commit is contained in:
commit
479143ab2a
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user