Don't allow removing TextEdit's main caret
This commit is contained in:
parent
ca25c6e0a3
commit
eac9adf7a1
|
@ -4380,7 +4380,7 @@ int TextEdit::add_caret(int p_line, int p_col) {
|
|||
}
|
||||
|
||||
void TextEdit::remove_caret(int p_caret) {
|
||||
ERR_FAIL_COND(carets.size() <= 0);
|
||||
ERR_FAIL_COND_MSG(carets.size() <= 1, "The main caret should not be removed.");
|
||||
ERR_FAIL_INDEX(p_caret, carets.size());
|
||||
carets.remove_at(p_caret);
|
||||
caret_index_edit_dirty = true;
|
||||
|
|
|
@ -3321,6 +3321,11 @@ TEST_CASE("[SceneTree][TextEdit] muiticaret") {
|
|||
CHECK(text_edit->get_caret_count() == 1);
|
||||
CHECK(text_edit->get_caret_line(0) == 0);
|
||||
CHECK(text_edit->get_caret_column(0) == 1);
|
||||
|
||||
ERR_PRINT_OFF;
|
||||
text_edit->remove_caret(0);
|
||||
CHECK(text_edit->get_caret_count() == 1);
|
||||
ERR_PRINT_ON;
|
||||
}
|
||||
|
||||
SUBCASE("[TextEdit] caret index edit order") {
|
||||
|
|
Loading…
Reference in New Issue