Merge pull request #79818 from garychia/select_all

RichTextLabel: Ensure the `select_all` function selects all items
This commit is contained in:
Rémi Verschelde 2023-08-28 12:03:29 +02:00
commit b00796eb1a
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -5310,6 +5310,8 @@ void RichTextLabel::selection_copy() {
} }
void RichTextLabel::select_all() { void RichTextLabel::select_all() {
_validate_line_caches();
if (!selection.enabled) { if (!selection.enabled) {
return; return;
} }
@ -5322,13 +5324,12 @@ void RichTextLabel::select_all() {
if (it->type != ITEM_FRAME) { if (it->type != ITEM_FRAME) {
if (!from_item) { if (!from_item) {
from_item = it; from_item = it;
} else {
to_item = it;
} }
to_item = it;
} }
it = _get_next_item(it, true); it = _get_next_item(it, true);
} }
if (!from_item || !to_item) { if (!from_item) {
return; return;
} }