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

Code before:
				table->column_max_width_dirty = true;
				// Compute minimum width for each cell.
				int idx = 0;
				for (Item *E : table->subitems) {
					ERR_CONTINUE(E->type != ITEM_FRAME); // Children should all be frames.
					ItemFrame *frame = static_cast<ItemFrame *>(E);

					const real_t frame_padding_space = frame->padding.position.x + frame->padding.size.x;

					int column = idx % col_count;
					ItemTable::Column &C = table->columns[column];

					float prev_h = 0;
					for (int i = 0; i < (int)frame->lines.size(); i++) {
						Line &line = frame->lines[i];
						MutexLock sub_lock(line.text_buf->get_mutex());

						int char_offset = l.char_offset + l.char_count;
						int w = _find_margin(line.from, p_base_font, p_base_font_size) + 1;
						prev_h = _shape_line(frame, i, p_base_font, p_base_font_size, w, prev_h, &char_offset);
						int cell_ch = (char_offset - (l.char_offset + l.char_count));
						l.char_count += cell_ch;
						t_char_count += cell_ch;
						remaining_characters -= cell_ch;

						C.min_width = MAX(C.min_width, std::ceil(frame_padding_space + line.indent) + std::ceil(line.text_buf->get_size().x));
						C.max_width = MAX(C.max_width, _get_line_max_width(frame, i));
					}
					idx++;
				}

				// Compute width for each column.
				const int available_width = p_width - l.offset.x - theme_cache.table_h_separation * col_count;
				_update_table_column_width(table, available_width);

				// Resize for elements in the table.
				idx = 0;
				for (Item *E : table->subitems) {
					ERR_CONTINUE(E->type != ITEM_FRAME); // Children should all be frames.
					ItemFrame *frame = static_cast<ItemFrame *>(E);

					const int frame_padding_space = std::ceil(frame->padding.position.x + frame->padding.size.x);

					int column = idx % col_count;
					float prev_h = 0;
					for (int i = 0; i < (int)frame->lines.size(); i++) {
						MutexLock sub_lock(frame->lines[i].text_buf->get_mutex());
						int w = table->columns[column].width - frame_padding_space;
						w = MAX(w, _find_margin(frame->lines[i].from, p_base_font, p_base_font_size) + 1);
						prev_h = _resize_line(frame, i, p_base_font, p_base_font_size, w, prev_h);
					}

Review comment (suggestion):
```suggestion
						C.min_width = MAX(C.min_width, Math::ceil(frame_padding_space + line.indent) + Math::ceil(line.text_buf->get_size().x));
```

Code after:

				table->column_max_width_dirty = true;
				// Compute minimum width for each cell.
				int idx = 0;
				for (Item *E : table->subitems) {
					ERR_CONTINUE(E->type != ITEM_FRAME); // Children should all be frames.
					ItemFrame *frame = static_cast<ItemFrame *>(E);

					const real_t frame_padding_space = frame->padding.position.x + frame->padding.size.x;

					int column = idx % col_count;
					ItemTable::Column &C = table->columns[column];

					float prev_h = 0;
					for (int i = 0; i < (int)frame->lines.size(); i++) {
						Line &line = frame->lines[i];
						MutexLock sub_lock(line.text_buf->get_mutex());

						int char_offset = l.char_offset + l.char_count;
						int w = _find_margin(line.from, p_base_font, p_base_font_size) + 1;
						prev_h = _shape_line(frame, i, p_base_font, p_base_font_size, w, prev_h, &char_offset);
						int cell_ch = (char_offset - (l.char_offset + l.char_count));
						l.char_count += cell_ch;
						t_char_count += cell_ch;
						remaining_characters -= cell_ch;

						C.min_width = MAX(C.min_width, Math::ceil(frame_padding_space + line.indent) + Math::ceil(line.text_buf->get_size().x));
						C.max_width = MAX(C.max_width, _get_line_max_width(frame, i));
					}
					idx++;
				}

				// Compute width for each column.
				const int available_width = p_width - l.offset.x - theme_cache.table_h_separation * col_count;
				_update_table_column_width(table, available_width);

				// Resize for elements in the table.
				idx = 0;
				for (Item *E : table->subitems) {
					ERR_CONTINUE(E->type != ITEM_FRAME); // Children should all be frames.
					ItemFrame *frame = static_cast<ItemFrame *>(E);

					const int frame_padding_space = Math::ceil(frame->padding.position.x + frame->padding.size.x);

					int column = idx % col_count;
					float prev_h = 0;
					for (int i = 0; i < (int)frame->lines.size(); i++) {
						MutexLock sub_lock(frame->lines[i].text_buf->get_mutex());
						int w = table->columns[column].width - frame_padding_space;
						w = MAX(w, _find_margin(frame->lines[i].from, p_base_font, p_base_font_size) + 1);
						prev_h = _resize_line(frame, i, p_base_font, p_base_font_size, w, prev_h);