From 93207bc48268465234dc1c55a5e3851f1d5b50b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Tue, 17 Mar 2020 11:47:47 +0100 Subject: [PATCH] render: render non-block cursors after rendering the glyph + decorations This fixes an issue where an 'underline' cursor wasn't visible on underlined text - the cursor was rendered first, and then shadowed by the text underline. --- CHANGELOG.md | 1 + render.c | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a4e76cbe..f5c7c8e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ * Sixel images moved or deleted on window resize. * Cursor sometimes incorrectly restored on exit from alternate screen. +* 'Underline' cursor being invisible on underlined text. ### Security diff --git a/render.c b/render.c index 2c00a513..66582b6c 100644 --- a/render.c +++ b/render.c @@ -432,14 +432,14 @@ render_cell(struct terminal *term, pixman_image_t *pix, PIXMAN_OP_SRC, pix, &bg, 1, &(pixman_rectangle16_t){x, y, cell_cols * width, height}); - if (has_cursor) - draw_cursor(term, cell, font, pix, &fg, &bg, x, y, cell_cols); - if (cell->attrs.blink) term_arm_blink_timer(term); + if (has_cursor && term->cursor_style == CURSOR_BLOCK) + draw_cursor(term, cell, font, pix, &fg, &bg, x, y, cell_cols); + if (cell->wc == 0 || cell->attrs.conceal) - return cell_cols; + goto draw_cursor; if (glyph != NULL) { if (unlikely(pixman_image_get_format(glyph->pix) == PIXMAN_a8r8g8b8)) { @@ -472,6 +472,10 @@ render_cell(struct terminal *term, pixman_image_t *pix, &fg, x, y, cell_cols); } +draw_cursor: + if (has_cursor && term->cursor_style != CURSOR_BLOCK) + draw_cursor(term, cell, font, pix, &fg, &bg, x, y, cell_cols); + return cell_cols; }