From 76a2ab7fbf531384278b58cd6c0ba05b00476c36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A3=8E=E9=9D=92=E5=B1=B1?= Date: Wed, 11 Feb 2026 20:15:08 +0800 Subject: [PATCH] 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. --- scene/gui/rich_text_label.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index 7f051e89b1..f89eef13f6 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -514,7 +514,7 @@ float RichTextLabel::_resize_line(ItemFrame *p_frame, int p_line, const Refcolumns[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 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) {