[TextEdit] Fix text edit font update order.

This commit is contained in:
Pāvels Nadtočajevs 2025-09-02 08:51:18 +03:00
parent 825ef2387f
commit 7368d148c1
No known key found for this signature in database
GPG key ID: 8413210218EF35D2

View file

@ -319,8 +319,19 @@ void TextEdit::Text::invalidate_cache(int p_line, bool p_text_changed) {
}
String remaining_string = text_with_ime.substr(from);
text_line.data_buf->add_string(remaining_string, font, font_size, language);
}
if (!bidi_override_with_ime.is_empty()) {
TS->shaped_text_set_bidi_override(text_line.data_buf->get_rid(), bidi_override_with_ime);
}
if (!p_text_changed) {
// Update fonts.
RID r = text_line.data_buf->get_rid();
int spans = TS->shaped_get_span_count(r);
for (int i = 0; i < spans; i++) {
TS->shaped_set_span_update_font(r, i, font->get_rids(), font_size, font->get_opentype_features());
}
} else {
// Update inline object sizes.
for (int i = 0; i < text_line.data_buf->get_line_count(); i++) {
for (Variant key : text_line.data_buf->get_line_objects(i)) {
@ -333,17 +344,6 @@ void TextEdit::Text::invalidate_cache(int p_line, bool p_text_changed) {
}
}
}
if (!bidi_override_with_ime.is_empty()) {
TS->shaped_text_set_bidi_override(text_line.data_buf->get_rid(), bidi_override_with_ime);
}
if (!p_text_changed) {
RID r = text_line.data_buf->get_rid();
int spans = TS->shaped_get_span_count(r);
for (int i = 0; i < spans; i++) {
TS->shaped_set_span_update_font(r, i, font->get_rids(), font_size, font->get_opentype_features());
}
}
// Apply tab align.
if (tab_size > 0) {