From 54661b7fc4bf8ac7e26a8b8e70599cf61f4fd933 Mon Sep 17 00:00:00 2001 From: newbee1905 Date: Tue, 26 Jul 2022 21:47:52 +0700 Subject: [PATCH] reflector: replace unecessary while loop --- kitty/fonts.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kitty/fonts.c b/kitty/fonts.c index ec8c91f4a..2d49047d7 100644 --- a/kitty/fonts.c +++ b/kitty/fonts.c @@ -393,7 +393,8 @@ calc_cell_metrics(FontGroup *fg) { underline_position = MIN(cell_height - 1, underline_position); // ensure there is at least a couple of pixels available to render styled underlines // there should be at least one pixel on either side of the underline_position - while (underline_position > baseline + 1 && cell_height - underline_position < 1) underline_position--; + if (underline_position > baseline + 1 && underline_position > cell_height - 1) + underline_position = MAX(baseline + 1, cell_height - 1); if (line_height_adjustment > 1) { baseline += MIN(cell_height - 1, (unsigned)line_height_adjustment / 2); underline_position += MIN(cell_height - 1, (unsigned)line_height_adjustment / 2);