Merge pull request #96706 from bruvzg/rtl_process

[RTL] Fix internal process incorrectly disabled on appending text.
This commit is contained in:
Rémi Verschelde 2024-09-08 23:22:19 +02:00
commit 20115dc36f
No known key found for this signature in database
GPG Key ID: C3336907360768E1

View File

@ -3412,6 +3412,21 @@ bool RichTextLabel::remove_paragraph(int p_paragraph, bool p_no_invalidate) {
selection.click_item = nullptr;
selection.active = false;
if (is_processing_internal()) {
bool process_enabled = false;
Item *it = main;
while (it) {
Vector<ItemFX *> fx_stack;
_fetch_item_fx_stack(it, fx_stack);
if (fx_stack.size()) {
process_enabled = true;
break;
}
it = _get_next_item(it, true);
}
set_process_internal(process_enabled);
}
if (p_no_invalidate) {
// Do not invalidate cache, only update vertical offsets of the paragraphs after deleted one and scrollbar.
int to_line = main->first_invalid_line.load() - 1;
@ -3985,6 +4000,7 @@ void RichTextLabel::pop_all() {
void RichTextLabel::clear() {
_stop_thread();
set_process_internal(false);
MutexLock data_lock(data_mutex);
main->_clear_children();
@ -4177,8 +4193,6 @@ void RichTextLabel::append_text(const String &p_bbcode) {
bool after_list_open_tag = false;
bool after_list_close_tag = false;
set_process_internal(false);
while (pos <= p_bbcode.length()) {
int brk_pos = p_bbcode.find_char('[', pos);
@ -5253,17 +5267,6 @@ void RichTextLabel::append_text(const String &p_bbcode) {
}
}
}
Vector<ItemFX *> fx_items;
for (Item *E : main->subitems) {
Item *subitem = static_cast<Item *>(E);
_fetch_item_fx_stack(subitem, fx_items);
if (fx_items.size()) {
set_process_internal(true);
break;
}
}
}
void RichTextLabel::scroll_to_selection() {