diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index d8248ac50f..584f0d0b2f 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -193,7 +193,8 @@ RichTextLabel::Item *RichTextLabel::_get_item_at_pos(RichTextLabel::Item *p_item } } break; case ITEM_TABLE: { - offset += 1; + ItemTable *table = static_cast(it); + offset += table->char_count; } break; default: break; @@ -781,6 +782,7 @@ float RichTextLabel::_shape_line(ItemFrame *p_frame, int p_line, const Ref } idx++; } + table->char_count = t_char_count; // Compute width for each column. const int available_width = p_width - l.offset.x - theme_cache.table_h_separation * col_count; diff --git a/scene/gui/rich_text_label.h b/scene/gui/rich_text_label.h index e8bbf42b5c..1053ee044e 100644 --- a/scene/gui/rich_text_label.h +++ b/scene/gui/rich_text_label.h @@ -408,6 +408,7 @@ private: int align_to_row = -1; int total_width = 0; int total_height = 0; + int char_count = 0; InlineAlignment inline_align = INLINE_ALIGNMENT_TOP; ItemTable() { type = ITEM_TABLE; } };