Restore ability to use foreground color unchanged for selections
This commit is contained in:
parent
2d66e37dcb
commit
6e351cd945
@ -12,7 +12,7 @@
|
||||
|
||||
// Inputs {{{
|
||||
layout(std140) uniform CellRenderData {
|
||||
float xstart, ystart, dx, dy, sprite_dx, sprite_dy, background_opacity, use_cell_for_selection_fg, use_cell_for_selection_bg;
|
||||
float xstart, ystart, dx, dy, sprite_dx, sprite_dy, background_opacity, use_cell_bg_for_selection_fg, use_cell_fg_for_selection_fg, use_cell_for_selection_bg;
|
||||
|
||||
uint default_fg, default_bg, highlight_fg, highlight_bg, cursor_fg, cursor_bg, url_color, url_style, inverted;
|
||||
|
||||
@ -188,7 +188,8 @@ void main() {
|
||||
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));
|
||||
// Selection
|
||||
vec3 selection_color = choose_color(use_cell_for_selection_fg, bg, color_to_vec(highlight_fg));
|
||||
vec3 selection_color = choose_color(use_cell_bg_for_selection_fg, bg, color_to_vec(highlight_fg));
|
||||
selection_color = choose_color(use_cell_fg_for_selection_fg, foreground, selection_color);
|
||||
foreground = choose_color(float(is_selected & ONE), selection_color, foreground);
|
||||
decoration_fg = choose_color(float(is_selected & ONE), selection_color, decoration_fg);
|
||||
// Underline and strike through (rendered via sprites)
|
||||
|
||||
@ -1214,7 +1214,8 @@ opt('selection_foreground', '#000000',
|
||||
The foreground and background colors for text selected with the mouse. Setting both of
|
||||
these to :code:`none` will cause a "reverse video" effect for selections, where the
|
||||
selection will be the cell text color and the text will become the cell background color.
|
||||
Note that these colors can be overridden by the program running in the terminal.
|
||||
Setting only selection_foreground to :code:`none` will cause the foreground color to be
|
||||
used unchanged. Note that these colors can be overridden by the program running in the terminal.
|
||||
''')
|
||||
|
||||
opt('selection_background', '#fffacd', option_type='to_color_or_none',)
|
||||
|
||||
@ -287,7 +287,7 @@ pick_cursor_color(Line *line, ColorProfile *color_profile, color_type cell_fg, c
|
||||
static void
|
||||
cell_update_uniform_block(ssize_t vao_idx, Screen *screen, int uniform_buffer, const CellRenderData *crd, CursorRenderInfo *cursor, bool inverted, OSWindow *os_window) {
|
||||
struct GPUCellRenderData {
|
||||
GLfloat xstart, ystart, dx, dy, sprite_dx, sprite_dy, background_opacity, use_cell_for_selection_fg, use_cell_for_selection_bg;
|
||||
GLfloat xstart, ystart, dx, dy, sprite_dx, sprite_dy, background_opacity, use_cell_bg_for_selection_fg, use_cell_fg_for_selection_color, use_cell_for_selection_bg;
|
||||
|
||||
GLuint default_fg, default_bg, highlight_fg, highlight_bg, cursor_fg, cursor_bg, url_color, url_style, inverted;
|
||||
|
||||
@ -303,7 +303,15 @@ cell_update_uniform_block(ssize_t vao_idx, Screen *screen, int uniform_buffer, c
|
||||
rd->default_fg = COLOR(default_fg); rd->default_bg = COLOR(default_bg);
|
||||
rd->highlight_fg = COLOR(highlight_fg); rd->highlight_bg = COLOR(highlight_bg);
|
||||
// selection
|
||||
rd->use_cell_for_selection_fg = IS_SPECIAL_COLOR(highlight_fg) ? 1. : 0.;
|
||||
if (IS_SPECIAL_COLOR(highlight_fg)) {
|
||||
if (IS_SPECIAL_COLOR(highlight_bg)) {
|
||||
rd->use_cell_bg_for_selection_fg = 1.f; rd->use_cell_fg_for_selection_color = 0.f;
|
||||
} else {
|
||||
rd->use_cell_bg_for_selection_fg = 0.f; rd->use_cell_fg_for_selection_color = 1.f;
|
||||
}
|
||||
} else {
|
||||
rd->use_cell_bg_for_selection_fg = 0.f; rd->use_cell_fg_for_selection_color = 0.f;
|
||||
}
|
||||
rd->use_cell_for_selection_bg = IS_SPECIAL_COLOR(highlight_bg) ? 1. : 0.;
|
||||
// Cursor position
|
||||
enum { BLOCK_IDX = 0, BEAM_IDX = 6, UNDERLINE_IDX = 7, UNFOCUSED_IDX = 8 };
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user