Use selection foreground color for underlines as well

Fixes #1982
This commit is contained in:
Kovid Goyal
2019-09-19 19:28:33 +05:30
parent 7b41bc95e1
commit 8f9a225c3a
2 changed files with 8 additions and 5 deletions

View File

@@ -25,6 +25,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
- Linux: Allow using fonts with spacing=90 in addition to fonts with
spacing=100 (:iss:`1968`)
- Use selection foreground color for underlines as well (:iss:`1982`)
0.14.4 [2019-08-31]
---------------------

View File

@@ -172,13 +172,15 @@ void main() {
foreground = color_to_vec(resolved_fg);
float has_dim = float((text_attrs >> DIM_SHIFT) & ONE);
effective_text_alpha = inactive_text_alpha * mix(1.0, dim_opacity, has_dim);
#ifdef USE_SELECTION_FG
// Selection
foreground = choose_color(float(is_selected & ONE), color_to_vec(highlight_fg), foreground);
#endif
// Underline and strike through (rendered via sprites)
float in_url = float((is_selected & TWO) >> 1);
decoration_fg = choose_color(in_url, color_to_vec(url_color), to_color(colors[2], resolved_fg));
#ifdef USE_SELECTION_FG
// Selection
vec3 selection_color = color_to_vec(highlight_fg);
foreground = choose_color(float(is_selected & ONE), selection_color, foreground);
decoration_fg = choose_color(float(is_selected & ONE), selection_color, decoration_fg);
#endif
// Underline and strike through (rendered via sprites)
underline_pos = choose_color(in_url, to_sprite_pos(pos, url_style, ZERO, ZERO), to_sprite_pos(pos, (text_attrs >> DECORATION_SHIFT) & THREE, ZERO, ZERO));
strike_pos = to_sprite_pos(pos, ((text_attrs >> STRIKE_SHIFT) & ONE) * FOUR, ZERO, ZERO);