diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2023-07-14 07:51:06 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2023-07-14 07:57:10 +0000 |
| commit | b3745b31c72042adf523b54be7c2a297a82cca7f (patch) | |
| tree | 62ad40a4ed1c6cc2030d8f5b3cf40a2528b449bd /render.c | |
| parent | themes: ayu-mirag: disable cursor colors by default (diff) | |
render: don’t invert cursor colors when custom colors are being used
When the user has configured custom cursor colors (cursor.color is set
in foot.ini), don’t invert those colors when the cell is either
selected, or has the ‘reverse’ attribute set.
This aligns foot’s behavior with Alacritty, Kitty and Wezterm. Contour
also behaves similarly, except mouse selections override the cursor
colors (turning the cursor invisible).
Closes #1347
Diffstat (limited to 'render.c')
| -rw-r--r-- | render.c | 14 |
1 files changed, 3 insertions, 11 deletions
@@ -405,19 +405,11 @@ cursor_colors_for_cell(const struct terminal *term, const struct cell *cell, const pixman_color_t *fg, const pixman_color_t *bg, pixman_color_t *cursor_color, pixman_color_t *text_color) { - bool is_selected = cell->attrs.selected; - if (term->cursor_color.cursor >> 31) { - *cursor_color = color_hex_to_pixman(term->cursor_color.cursor); - *text_color = color_hex_to_pixman( - term->cursor_color.text >> 31 - ? term->cursor_color.text : term->colors.bg); + xassert(term->cursor_color.text >> 31); - if (cell->attrs.reverse ^ is_selected) { - pixman_color_t swap = *cursor_color; - *cursor_color = *text_color; - *text_color = swap; - } + *cursor_color = color_hex_to_pixman(term->cursor_color.cursor); + *text_color = color_hex_to_pixman(term->cursor_color.text); } else { *cursor_color = *fg; *text_color = *bg; |
