From 0c7725217a706f6df1b543c4c85f54872aaf2f21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Thu, 27 Jun 2024 18:54:46 +0200 Subject: [PATCH] render: draw_styled_underline(): respect main.underline-thickness Also refactor a bit, and break out early to draw_underline() for legacy underlines. --- render.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/render.c b/render.c index 65fd1739..35b7c6ae 100644 --- a/render.c +++ b/render.c @@ -392,7 +392,15 @@ draw_styled_underline(const struct terminal *term, pixman_image_t *pix, { xassert(style != CURLY_NONE); - const int thickness = font->underline.thickness; + if (style == CURLY_SINGLE) { + draw_underline(term, pix, font, color, x, y, cols); + return; + } + + const int thickness = term->conf->underline_thickness.px >= 0 + ? term_pt_or_px_as_pixels( + term, &term->conf->underline_thickness) + : font->underline.thickness; int y_ofs; @@ -404,10 +412,16 @@ draw_styled_underline(const struct terminal *term, pixman_image_t *pix, term->cell_height - thickness * 3); break; - default: + case CURLY_DASHED: + case CURLY_DOTTED: y_ofs = min(underline_offset(term, font), term->cell_height - thickness); break; + + case CURLY_NONE: + case CURLY_SINGLE: + BUG("underline styles not supposed to be handled here"); + break; } const int ceil_w = cols * term->cell_width; @@ -518,8 +532,9 @@ draw_styled_underline(const struct terminal *term, pixman_image_t *pix, break; } - default: - draw_underline(term, pix, font, color, x, y, cols); + case CURLY_NONE: + case CURLY_SINGLE: + BUG("underline styles not supposed to be handled here"); break; } }