diff --git a/kitty/fonts/render.py b/kitty/fonts/render.py index f5b2c9fe2..217187c32 100644 --- a/kitty/fonts/render.py +++ b/kitty/fonts/render.py @@ -400,10 +400,13 @@ def prerender_function( render_cursor, cursor_beam_thickness=cursor_beam_thickness, cursor_underline_thickness=cursor_underline_thickness, cell_width=cell_width, cell_height=cell_height, dpi_x=dpi_x, dpi_y=dpi_y) - cells = list(map(f, range(1, NUM_UNDERLINE_STYLES + 1))) - cells.append(f(0, strikethrough=True)) - cells.append(f(missing=True)) - cells.extend((c(1), c(2), c(3))) + # If you change the mapping of these cells you will need to change + # NUM_UNDERLINE_STYLES and BEAM_IDX in shader.c and STRIKE_SPRITE_INDEX in + # window.py and MISSING_GLYPH in font.c + cells = list(map(f, range(1, NUM_UNDERLINE_STYLES + 1))) # underline sprites + cells.append(f(0, strikethrough=True)) # strikethrough sprite + cells.append(f(missing=True)) # missing glyph + cells.extend((c(1), c(2), c(3))) # cursor glyphs tcells = tuple(cells) return tuple(map(ctypes.addressof, tcells)), tcells diff --git a/kitty/shaders.c b/kitty/shaders.c index d99166ff0..a4ae4e905 100644 --- a/kitty/shaders.c +++ b/kitty/shaders.c @@ -314,7 +314,7 @@ cell_update_uniform_block(ssize_t vao_idx, Screen *screen, int uniform_buffer, c } rd->use_cell_for_selection_bg = IS_SPECIAL_COLOR(highlight_bg) ? 1. : 0.; // Cursor position - enum { BLOCK_IDX = 0, BEAM_IDX = 8, UNDERLINE_IDX = 9, UNFOCUSED_IDX = 10 }; + enum { BLOCK_IDX = 0, BEAM_IDX = NUM_UNDERLINE_STYLES + 3, UNDERLINE_IDX = NUM_UNDERLINE_STYLES + 4, UNFOCUSED_IDX = NUM_UNDERLINE_STYLES + 5 }; if (cursor->is_visible) { rd->cursor_x = screen->cursor->x, rd->cursor_y = screen->cursor->y; if (cursor->is_focused) {