Skip to content

Commit c646b57

Browse files
committed
Merge pull request godotengine#117011 from bruvzg/rtl_tab_off
[RTL] Fix character click offsets after the table.
2 parents 891069d + 70906e4 commit c646b57

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

scene/gui/rich_text_label.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,8 @@ RichTextLabel::Item *RichTextLabel::_get_item_at_pos(RichTextLabel::Item *p_item
229229
}
230230
} break;
231231
case ITEM_TABLE: {
232-
offset += 1;
232+
ItemTable *table = static_cast<ItemTable *>(it);
233+
offset += table->char_count;
233234
} break;
234235
default:
235236
break;
@@ -817,6 +818,7 @@ float RichTextLabel::_shape_line(ItemFrame *p_frame, int p_line, const Ref<Font>
817818
}
818819
idx++;
819820
}
821+
table->char_count = t_char_count;
820822

821823
// Compute width for each column.
822824
const int available_width = p_width - l.offset.x - theme_cache.table_h_separation * col_count;

scene/gui/rich_text_label.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,7 @@ class RichTextLabel : public Control {
387387
int align_to_row = -1;
388388
int total_width = 0;
389389
int total_height = 0;
390+
int char_count = 0;
390391
InlineAlignment inline_align = INLINE_ALIGNMENT_TOP;
391392
ItemTable() { type = ITEM_TABLE; }
392393
};

0 commit comments

Comments
 (0)