From ab08ba80ec08cefecc693fde4d318932049e6f18 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 1 Oct 2026 17:31:24 +0530 Subject: [PATCH] Cleanup previous PR Scale DIM undimming under reverse video cursors by cursor opacity When a reverse video block cursor fades during animated blinking, the text color is mostly the cell's own foreground, so removing the DIM alpha unconditionally made dim text flash to full brightness each blink cycle. --- kitty/shaders/cell.slang | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kitty/shaders/cell.slang b/kitty/shaders/cell.slang index 967033025..d783d3c16 100644 --- a/kitty/shaders/cell.slang +++ b/kitty/shaders/cell.slang @@ -161,9 +161,11 @@ vertex_main( vo.colored_sprite = float((sprite_idx[0] & SPRITE_COLORED_MASK) >> SPRITE_COLORED_SHIFT); float has_dim = float((text_attrs >> DIM_SHIFT) & BIT_MASK), has_blink = float((text_attrs >> BLINK_SHIFT) & BIT_MASK); - float dim_under_reverse_cursor = has_dim * (1.0 - cell_data.has_block_cursor * cell_data.reverse_video_cursor); + // A reverse video block cursor already uses the dimmed foreground as its text color, so fade out + // the DIM alpha in step with the cursor opacity to avoid dimming twice without un-dimming a fading cursor + float undim = cell_data.has_block_cursor * cell_data.reverse_video_cursor * crd.cursor_opacity; vo.effective_text_alpha = - crd.inactive_text_alpha * if_one_then(dim_under_reverse_cursor, crd.dim_opacity, 1.0) * if_one_then(has_blink, crd.blink_opacity, 1.0); + crd.inactive_text_alpha * if_one_then(has_dim, lerp(crd.dim_opacity, 1.0, undim), 1.0) * if_one_then(has_blink, crd.blink_opacity, 1.0); float in_url = float((is_selected >> 1) & BIT_MASK); vo.decoration_fg = if_one_then(in_url, crd.url_color_lin.rgb, to_color(colors[2], fg_as_uint)); // Selection