summaryrefslogtreecommitdiff
path: root/scene/gui/text_edit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui/text_edit.cpp')
-rw-r--r--scene/gui/text_edit.cpp25
1 files changed, 15 insertions, 10 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 10889313d0..a0dd26b3a6 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -1147,7 +1147,7 @@ void TextEdit::_consume_pair_symbol(CharType ch) {
int new_column,new_line;
- _begin_compex_operation();
+ begin_complex_operation();
_insert_text(get_selection_from_line(), get_selection_from_column(),
ch_single,
&new_line, &new_column);
@@ -1160,7 +1160,7 @@ void TextEdit::_consume_pair_symbol(CharType ch) {
get_selection_to_column() + to_col_offset,
ch_single_pair,
&new_line,&new_column);
- _end_compex_operation();
+ end_complex_operation();
cursor_set_line(get_selection_to_line());
cursor_set_column(get_selection_to_column() + to_col_offset);
@@ -1614,7 +1614,7 @@ void TextEdit::_input_event(const InputEvent& p_input_event) {
// remove the old character if in insert mode
if (insert_mode) {
- _begin_compex_operation();
+ begin_complex_operation();
// make sure we don't try and remove empty space
if (cursor.column < get_line(cursor.line).length()) {
@@ -1625,7 +1625,7 @@ void TextEdit::_input_event(const InputEvent& p_input_event) {
_insert_text_at_cursor(chr);
if (insert_mode) {
- _end_compex_operation();
+ end_complex_operation();
}
}
}
@@ -1701,10 +1701,10 @@ void TextEdit::_input_event(const InputEvent& p_input_event) {
cursor_set_line(selection.from_line);
cursor_set_column(selection.from_column);
- _begin_compex_operation();
+ begin_complex_operation();
_remove_text(selection.from_line,selection.from_column,selection.to_line,selection.to_column);
_insert_text_at_cursor(txt);
- _end_compex_operation();
+ end_complex_operation();
selection.active=true;
selection.from_column=sel_column;
selection.from_line=sel_line;
@@ -1762,6 +1762,7 @@ void TextEdit::_input_event(const InputEvent& p_input_event) {
}
if (clear) {
+ begin_complex_operation();
selection.active=false;
update();
_remove_text(selection.from_line,selection.from_column,selection.to_line,selection.to_column);
@@ -2410,7 +2411,7 @@ void TextEdit::_input_event(const InputEvent& p_input_event) {
// remove the old character if in insert mode and no selection
if (insert_mode && !had_selection) {
- _begin_compex_operation();
+ begin_complex_operation();
// make sure we don't try and remove empty space
if (cursor.column < get_line(cursor.line).length()) {
@@ -2430,7 +2431,11 @@ void TextEdit::_input_event(const InputEvent& p_input_event) {
}
if (insert_mode && !had_selection) {
- _end_compex_operation();
+ end_complex_operation();
+ }
+
+ if (selection.active != had_selection) {
+ end_complex_operation();
}
accept_event();
} else {
@@ -3624,12 +3629,12 @@ void TextEdit::clear_undo_history() {
}
-void TextEdit::_begin_compex_operation() {
+void TextEdit::begin_complex_operation() {
_push_current_op();
next_operation_is_complex=true;
}
-void TextEdit::_end_compex_operation() {
+void TextEdit::end_complex_operation() {
_push_current_op();
ERR_FAIL_COND(undo_stack.size() == 0);