diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2024-06-27 16:54:46 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2024-06-27 17:21:23 +0000 |
| commit | 0c7725217a706f6df1b543c4c85f54872aaf2f21 (patch) | |
| tree | 329e3ead330488f8061981e8b916ec41cfb2dc4d /render.c | |
| parent | render: underlines: improve the appearance of the 'dotted' style (diff) | |
render: draw_styled_underline(): respect main.underline-thickness
Also refactor a bit, and break out early to draw_underline() for
legacy underlines.
Diffstat (limited to 'render.c')
| -rw-r--r-- | render.c | 23 |
1 files changed, 19 insertions, 4 deletions
@@ -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; } } |
