Another place to use NUM_UNDERLINE_STYLES

This commit is contained in:
Kovid Goyal 2022-02-04 14:16:31 +05:30
parent 6b47f6f769
commit f9b35c71d7
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 8 additions and 5 deletions

View File

@ -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

View File

@ -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) {