summaryrefslogtreecommitdiff
path: root/scene/gui/text_edit.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-01-16 15:54:42 +0100
committerGitHub <noreply@github.com>2022-01-16 15:54:42 +0100
commit8958e1b35297baa8ef4f9e03bb4ad105500e3a0c (patch)
tree18f95b78321dce6ffd9bff18d4d14b5fe4507c80 /scene/gui/text_edit.cpp
parent19804730ee432658a2ab7f8f784bc5946f56c508 (diff)
parent034f31aa5c368a4f9a4a7d20cd20d968d6638031 (diff)
Merge pull request #56720 from volokh0x/to-fix-#56274
Diffstat (limited to 'scene/gui/text_edit.cpp')
-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 17f2ed1db5..2b10ead8f6 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;