Repository: godotengine/godot
File: scene/gui/rich_text_label.cpp (C++)

Code before:
	p_table->total_height = 0;
	p_table->rows.clear();
	p_table->rows_no_padding.clear();
	p_table->rows_baseline.clear();

	Vector2 offset = Vector2(theme_cache.table_h_separation * 0.5, theme_cache.table_v_separation * 0.5).floor();
	float row_height = 0.0;
	float row_top_padding = 0.0;
	float row_bottom_padding = 0.0;
	const List<Item *>::Element *prev = p_table->subitems.front();

	for (const List<Item *>::Element *E = prev; E; E = E->next()) {
		ERR_CONTINUE(E->get()->type != ITEM_FRAME); // Children should all be frames.
		ItemFrame *frame = static_cast<ItemFrame *>(E->get());

		int column = idx % col_count;
		const real_t frame_padding_space = frame->padding.position.x + frame->padding.size.x;

		offset.x += frame->padding.position.x;
		float yofs = 0.0;
		float prev_h = 0.0;
		float row_baseline = 0.0;
		for (int i = 0; i < (int)frame->lines.size(); i++) {
			Line &line = frame->lines[i];
			MutexLock sub_lock(line.text_buf->get_mutex());
			line.text_buf->set_width(p_table->columns[column].width - std::ceil(frame_padding_space + line.indent));
			line.offset.y = prev_h;

			float h = line.text_buf->get_size().y + (line.text_buf->get_line_count() - 1) * theme_cache.line_separation;
			if (i > 0) {
				h += theme_cache.paragraph_separation + theme_cache.line_separation;
			}
			if (frame->min_size_over.y > 0) {
				h = MAX(h, frame->min_size_over.y);
			}
			if (frame->max_size_over.y > 0) {
				h = MIN(h, frame->max_size_over.y);
			}
			yofs += h;
			prev_h = line.offset.y + line.text_buf->get_size().y + line.text_buf->get_line_count() * theme_cache.line_separation + theme_cache.paragraph_separation;

			line.offset += offset;
			row_baseline = MAX(row_baseline, line.text_buf->get_line_ascent(line.text_buf->get_line_count() - 1));
		}
		row_top_padding = MAX(row_top_padding, frame->padding.position.y);
		row_bottom_padding = MAX(row_bottom_padding, frame->padding.size.y);

		offset.x += p_table->columns[column].width + theme_cache.table_h_separation - frame->padding.position.x;

		row_height = MAX(yofs, row_height);
		// Add row height after last column of the row or last cell of the table.

Review comment (suggestion):
```suggestion
			line.text_buf->set_width(p_table->columns[column].width - Math::ceil(frame_padding_space + line.indent));
```

Code after:
	int idx = 0;
	p_table->total_height = 0;
	p_table->rows.clear();
	p_table->rows_baseline.clear();

	Vector2 offset = Vector2(theme_cache.table_h_separation * 0.5, theme_cache.table_v_separation * 0.5).floor();
	float row_height = 0.0;
	const List<Item *>::Element *prev = p_table->subitems.front();

	for (const List<Item *>::Element *E = prev; E; E = E->next()) {
		ERR_CONTINUE(E->get()->type != ITEM_FRAME); // Children should all be frames.
		ItemFrame *frame = static_cast<ItemFrame *>(E->get());

		int column = idx % col_count;
		const real_t frame_padding_space = frame->padding.position.x + frame->padding.size.x;

		offset += frame->padding.position;
		float yofs = 0.0;
		float prev_h = 0.0;
		float row_baseline = 0.0;
		for (int i = 0; i < (int)frame->lines.size(); i++) {
			Line &line = frame->lines[i];
			MutexLock sub_lock(line.text_buf->get_mutex());
			line.text_buf->set_width(p_table->columns[column].width - Math::ceil(frame_padding_space + line.indent));
			line.offset.y = prev_h;

			float h = line.text_buf->get_size().y + (line.text_buf->get_line_count() - 1) * theme_cache.line_separation;
			if (i > 0) {
				h += theme_cache.paragraph_separation + theme_cache.line_separation;
			}
			if (frame->min_size_over.y > 0) {
				h = MAX(h, frame->min_size_over.y);
			}
			if (frame->max_size_over.y > 0) {
				h = MIN(h, frame->max_size_over.y);
			}
			yofs += h;
			prev_h = line.offset.y + line.text_buf->get_size().y + line.text_buf->get_line_count() * theme_cache.line_separation + theme_cache.paragraph_separation;

			line.offset += offset;
			row_baseline = MAX(row_baseline, line.text_buf->get_line_ascent(line.text_buf->get_line_count() - 1));
		}

		offset -= frame->padding.position;
		offset.x += p_table->columns[column].width + theme_cache.table_h_separation;

		row_height = MAX(yofs + frame->padding.position.y + frame->padding.size.y, row_height);
		// Add row height after last column of the row or last cell of the table.
		if (column == col_count - 1 || E->next() == nullptr) {
			offset.x = Math::floor(theme_cache.table_h_separation * 0.5);
			row_height += theme_cache.table_v_separation;