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

Code before:
						}
					}
				}

				Color font_color = (step == DRAW_STEP_SHADOW_OUTLINE || step == DRAW_STEP_SHADOW || step == DRAW_STEP_OUTLINE || step == DRAW_STEP_TEXT) ? _find_color(it, p_base_color) : Color();
				int outline_size = (step == DRAW_STEP_OUTLINE) ? _find_outline_size(it, p_outline_size) : 0;
				Color font_outline_color = (step == DRAW_STEP_OUTLINE) ? _find_outline_color(it, p_outline_color) : Color();
				Color font_shadow_color = p_font_shadow_color;
				bool txt_visible = (font_color.a != 0);
				if (step == DRAW_STEP_OUTLINE && (outline_size <= 0 || font_outline_color.a == 0)) {
					processed_glyphs_step += glyphs[i].repeat;
					off_step.x += glyphs[i].advance * glyphs[i].repeat;
					continue;
				} else if (step == DRAW_STEP_SHADOW_OUTLINE && (font_shadow_color.a == 0 || p_shadow_outline_size <= 0)) {
					processed_glyphs_step += glyphs[i].repeat;
					off_step.x += glyphs[i].advance * glyphs[i].repeat;
					continue;
				} else if (step == DRAW_STEP_SHADOW && (font_shadow_color.a == 0)) {
					processed_glyphs_step += glyphs[i].repeat;
					off_step.x += glyphs[i].advance * glyphs[i].repeat;
					continue;
				} else if (step == DRAW_STEP_TEXT) {
					Color user_ul_color = Color(0, 0, 0, 0);
					bool has_ul = _find_underline(it, &user_ul_color);
					if (!has_ul && underline_meta) {
						ItemMeta *meta = nullptr;
						if (_find_meta(it, nullptr, &meta) && meta) {
							switch (meta->underline) {
								case META_UNDERLINE_ALWAYS: {
									has_ul = true;
								} break;
								case META_UNDERLINE_NEVER: {
									has_ul = false;
								} break;
								case META_UNDERLINE_ON_HOVER: {
									has_ul = (meta == meta_hovering);
								} break;
							}
						}
					}
					if (has_ul) {
						Color new_ul_color;
						if (user_ul_color.a == 0.0) {
							new_ul_color = font_color;
							new_ul_color.a *= float(theme_cache.underline_alpha) / 100.0;
						} else {
							new_ul_color = user_ul_color;
						}
						if (ul_started && new_ul_color != ul_color_prev) {
							float y_off = upos;
							float underline_width = MAX(1.0, uth * theme_cache.base_scale);

Review comment (suggestion):
The drawn border will extend beyond the rect on the left and top sides.

In RTL, because cells in a row are drawn from right to left, the border of the right cell may be covered by the background color of the left cell.

Code after:
									int row = idx / col_count;

									const Size2 cell_size = Size2(table->columns[col].width + h_separation, table->rows[row]);

									if (frame->lines.size() != 0 && row < row_count) {
										Vector2 coff = frame->lines[0].offset - frame->padding.position;
										coff.x -= frame->lines[0].indent;
										if (rtl) {
											coff.x = rect.size.width - table->columns[col].width - coff.x;
										}

										const Point2 cell_ofs = table_ofs + coff;
										Rect2 cell_rect = Rect2(cell_ofs, cell_size);

										Color row_bg;
										if (row % 2 == 0) {
											row_bg = frame->odd_row_bg != Color(0, 0, 0, 0) ? frame->odd_row_bg : odd_row_bg;
										} else {
											row_bg = frame->even_row_bg != Color(0, 0, 0, 0) ? frame->even_row_bg : even_row_bg;
										}
										if (row_bg.a > 0.0) {
											if (right_has_border) {
												// To prevent the border of the right cell from being covered.
												cell_rect.size.x -= 1;
												draw_rect(cell_rect, row_bg, true);
												cell_rect.size.x += 1;
											} else {
												draw_rect(cell_rect, row_bg, true);
											}
										}

										right_has_border = false;

										Color bc = frame->border != Color(0, 0, 0, 0) ? frame->border : border;
										if (bc.a > 0.0) {
											if (rtl && col < col_count - 1) {
												right_has_border = true;
											}
											draw_rect(cell_rect, bc, false);
										}
									}

									for (int j = 0; j < (int)frame->lines.size(); j++) {
										_draw_line(frame, j, p_ofs + rect.position + off + Vector2(0, frame->lines[j].offset.y), rect.size.x, 0, p_base_color, p_outline_size, p_outline_color, p_font_shadow_color, p_shadow_outline_size, p_shadow_ofs, r_processed_glyphs);
									}
									idx++;
								}
							} break;
							default:
								break;
						}