Fix the table is too wide when using indentation in RichTextLabel

Line indentation (offset) is not taken into account when calculating
the available width of the table.

However, when drawing a table, its offset takes into account line
indentation.
This commit is contained in:
风青山 2026-02-11 20:15:08 +08:00
parent 92a90a8e6f
commit 76a2ab7fbf
No known key found for this signature in database
GPG key ID: 8DFDAA198ED5EDF5

View file

@ -514,7 +514,7 @@ float RichTextLabel::_resize_line(ItemFrame *p_frame, int p_line, const Ref<Font
table->columns[i].width = 0;
}
const int available_width = p_width - theme_cache.table_h_separation * (col_count - 1);
const int available_width = p_width - l.offset.x - theme_cache.table_h_separation * (col_count - 1);
int base_column_width = available_width / col_count;
for (Item *E : table->subitems) {
@ -698,7 +698,7 @@ float RichTextLabel::_shape_line(ItemFrame *p_frame, int p_line, const Ref<Font>
table->columns[i].width = 0;
}
// Compute minimum width for each cell.
const int available_width = p_width - theme_cache.table_h_separation * (col_count - 1);
const int available_width = p_width - l.offset.x - theme_cache.table_h_separation * (col_count - 1);
int base_column_width = available_width / col_count;
int idx = 0;
for (Item *E : table->subitems) {