summaryrefslogtreecommitdiffstats
path: root/scene/gui/text_edit.cpp
diff options
context:
space:
mode:
authorYuri Sizov <yuris@humnom.net>2023-12-20 15:07:52 +0100
committerYuri Sizov <yuris@humnom.net>2023-12-20 15:07:52 +0100
commit02bc2a37dd5927f178ba96e08edb9a75a044b285 (patch)
tree35771c2c937ff316c92178f9638e8b4797e5870a /scene/gui/text_edit.cpp
parentaae58cd6880cf76555cb9a49cf6b1e8c71692ce0 (diff)
parent4b82cacc219266cdb16c59f037766e1fc8d25d47 (diff)
downloadredot-engine-02bc2a37dd5927f178ba96e08edb9a75a044b285.tar.gz
Merge pull request #86118 from TheSofox/complex-undo-select-fix
Fix so undoing complex operations in `TextEdit` will restore selections
Diffstat (limited to 'scene/gui/text_edit.cpp')
-rw-r--r--scene/gui/text_edit.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 308250c592..cd1450b879 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -7690,7 +7690,11 @@ void TextEdit::_insert_text(int p_line, int p_char, const String &p_text, int *r
op.version = ++version;
op.chain_forward = false;
op.chain_backward = false;
- op.start_carets = carets;
+ if (next_operation_is_complex) {
+ op.start_carets = current_op.start_carets;
+ } else {
+ op.start_carets = carets;
+ }
op.end_carets = carets;
// See if it should just be set as current op.
@@ -7745,7 +7749,11 @@ void TextEdit::_remove_text(int p_from_line, int p_from_column, int p_to_line, i
op.version = ++version;
op.chain_forward = false;
op.chain_backward = false;
- op.start_carets = carets;
+ if (next_operation_is_complex) {
+ op.start_carets = current_op.start_carets;
+ } else {
+ op.start_carets = carets;
+ }
op.end_carets = carets;
// See if it should just be set as current op.