Fix selection_forground=none not being respected

This commit is contained in:
Kovid Goyal 2021-12-05 22:00:43 +05:30
parent 2da25d9187
commit 2d66e37dcb
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 0 additions and 8 deletions

View File

@ -187,12 +187,10 @@ void main() {
effective_text_alpha = inactive_text_alpha * mix(1.0, dim_opacity, has_dim); effective_text_alpha = inactive_text_alpha * mix(1.0, dim_opacity, has_dim);
float in_url = float((is_selected & TWO) >> 1); float in_url = float((is_selected & TWO) >> 1);
decoration_fg = choose_color(in_url, color_to_vec(url_color), to_color(colors[2], fg_as_uint)); decoration_fg = choose_color(in_url, color_to_vec(url_color), to_color(colors[2], fg_as_uint));
#ifdef USE_SELECTION_FG
// Selection // Selection
vec3 selection_color = choose_color(use_cell_for_selection_fg, bg, color_to_vec(highlight_fg)); vec3 selection_color = choose_color(use_cell_for_selection_fg, bg, color_to_vec(highlight_fg));
foreground = choose_color(float(is_selected & ONE), selection_color, foreground); foreground = choose_color(float(is_selected & ONE), selection_color, foreground);
decoration_fg = choose_color(float(is_selected & ONE), selection_color, decoration_fg); decoration_fg = choose_color(float(is_selected & ONE), selection_color, decoration_fg);
#endif
// Underline and strike through (rendered via sprites) // 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)); 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); strike_pos = to_sprite_pos(pos, ((text_attrs >> STRIKE_SHIFT) & ONE) * FOUR, ZERO, ZERO);

View File

@ -165,7 +165,6 @@ def _run_app(opts: Options, args: CLIOptions, bad_lines: Sequence[BadLine] = ())
set_custom_ibeam_cursor() set_custom_ibeam_cursor()
if not is_wayland() and not is_macos: # no window icons on wayland if not is_wayland() and not is_macos: # no window icons on wayland
set_x11_window_icon() set_x11_window_icon()
load_shader_programs.use_selection_fg = opts.selection_foreground is not None
with cached_values_for(run_app.cached_values_name) as cached_values: with cached_values_for(run_app.cached_values_name) as cached_values:
with startup_notification_handler(extra_callback=run_app.first_window_callback) as pre_show_callback: with startup_notification_handler(extra_callback=run_app.first_window_callback) as pre_show_callback:
window_id = create_os_window( window_id = create_os_window(

View File

@ -207,8 +207,6 @@ def as_text(
class LoadShaderPrograms: class LoadShaderPrograms:
use_selection_fg = True
def __call__(self, semi_transparent: bool = False) -> None: def __call__(self, semi_transparent: bool = False) -> None:
compile_program(BLIT_PROGRAM, *load_shaders('blit')) compile_program(BLIT_PROGRAM, *load_shaders('blit'))
v, f = load_shaders('cell') v, f = load_shaders('cell')
@ -232,9 +230,6 @@ class LoadShaderPrograms:
if semi_transparent: if semi_transparent:
vv = vv.replace('#define NOT_TRANSPARENT', '#define TRANSPARENT') vv = vv.replace('#define NOT_TRANSPARENT', '#define TRANSPARENT')
ff = ff.replace('#define NOT_TRANSPARENT', '#define TRANSPARENT') ff = ff.replace('#define NOT_TRANSPARENT', '#define TRANSPARENT')
if not load_shader_programs.use_selection_fg:
vv = vv.replace('#define USE_SELECTION_FG', '#define DONT_USE_SELECTION_FG')
ff = ff.replace('#define USE_SELECTION_FG', '#define DONT_USE_SELECTION_FG')
compile_program(p, vv, ff) compile_program(p, vv, ff)
v, f = load_shaders('graphics') v, f = load_shaders('graphics')