Skip to content

Commit

Permalink
Merge pull request godotengine#96706 from bruvzg/rtl_process
Browse files Browse the repository at this point in the history
[RTL] Fix internal process incorrectly disabled on appending text.
  • Loading branch information
akien-mga committed Sep 8, 2024
2 parents c26545c + ccf837b commit 20115dc
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions scene/gui/rich_text_label.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit 20115dc

Please sign in to comment.