summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
authorvolokh0x <volokh0x@gmail.com>2022-01-12 13:42:38 +0200
committervolokh0x <volokh0x@gmail.com>2022-01-16 15:00:57 +0200
commit034f31aa5c368a4f9a4a7d20cd20d968d6638031 (patch)
tree313e037794c9630376d3914099ef5cd214f13849 /scene/gui
parent9f058674acebf9a7a0704cdbc26dc9f6d853b16e (diff)
Save clear action of TextEdit in history when used from context menu
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/text_edit.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 63e3740a97..5f38a23f1a 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -2812,6 +2812,17 @@ void TextEdit::clear() {
}
void TextEdit::_clear() {
+ if (editable && undo_enabled) {
+ _move_caret_document_start(false);
+ begin_complex_operation();
+
+ _remove_text(0, 0, MAX(0, get_line_count() - 1), MAX(get_line(MAX(get_line_count() - 1, 0)).size() - 1, 0));
+ insert_text_at_caret("");
+ text.clear();
+
+ end_complex_operation();
+ return;
+ }
clear_undo_history();
text.clear();
caret.column = 0;