From 4a95e8e48cdb3555ade20e7e3959a12856a1a6b4 Mon Sep 17 00:00:00 2001 From: Bryan Lee <38807139+liby@users.noreply.github.com> Date: Tue, 4 Feb 2025 20:50:34 +0800 Subject: [PATCH] Fix cursor character not visible when cursor color matches background --- src/renderer/shaders/cell.metal | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/renderer/shaders/cell.metal b/src/renderer/shaders/cell.metal index 3ca0f9149..5f161c6b7 100644 --- a/src/renderer/shaders/cell.metal +++ b/src/renderer/shaders/cell.metal @@ -471,16 +471,15 @@ vertex CellTextVertexOut cell_text_vertex( out.color = contrasted_color(uniforms.min_contrast, out.color, out.bg_color); } - // If this cell is the cursor cell, then we need to change the color. - if ( - in.mode != MODE_TEXT_CURSOR && - ( + // Check if current position is under cursor (including wide cursor) + bool is_cursor_pos = ( in.grid_pos.x == uniforms.cursor_pos.x || uniforms.cursor_wide && in.grid_pos.x == uniforms.cursor_pos.x + 1 - ) && - in.grid_pos.y == uniforms.cursor_pos.y - ) { + ) && in.grid_pos.y == uniforms.cursor_pos.y; + + // If this cell is the cursor cell, then we need to change the color. + if (in.mode != MODE_TEXT_CURSOR && is_cursor_pos) { out.color = load_color( uniforms.cursor_color, uniforms.use_display_p3, @@ -490,7 +489,8 @@ vertex CellTextVertexOut cell_text_vertex( // Don't bother rendering if the bg and fg colors are identical, just return // the same point which will be culled because it makes the quad zero sized. - if (all(out.color == out.bg_color)) { + // However, we should still render if this is the cursor position + if (all(out.color == out.bg_color) && !is_cursor_pos) { out.position = float4(0.0); }