Skip to content

Commit

Permalink
Merge pull request #56720 from volokh0x/to-fix-#56274
Browse files Browse the repository at this point in the history
  • Loading branch information
akien-mga authored Jan 16, 2022
2 parents 1980473 + 034f31a commit 8958e1b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions scene/gui/text_edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 8958e1b

Please sign in to comment.