Fix using cursor=none not working on text that has reverse video
Fixes #5897
This commit is contained in:
parent
dc03c14af2
commit
03abbb315a
@ -91,6 +91,8 @@ Detailed list of changes
|
|||||||
|
|
||||||
- When reporting unused activity in a window, ignore activity that occurs soon after a window resize (:iss:`5881`)
|
- When reporting unused activity in a window, ignore activity that occurs soon after a window resize (:iss:`5881`)
|
||||||
|
|
||||||
|
- Fix using :opt:`cursor` = ``none`` not working on text that has reverse video (:iss:`5897`)
|
||||||
|
|
||||||
|
|
||||||
0.26.5 [2022-11-07]
|
0.26.5 [2022-11-07]
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|||||||
@ -626,11 +626,17 @@ resolve_color(ColorProfile *cp, color_type val, color_type defval) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
colors_for_cell(Line *self, ColorProfile *cp, index_type *x, color_type *fg, color_type *bg) {
|
colors_for_cell(Line *self, ColorProfile *cp, index_type *x, color_type *fg, color_type *bg, bool *reversed) {
|
||||||
if (*x >= self->xnum) return false;
|
if (*x >= self->xnum) return false;
|
||||||
if (*x > 0 && !self->gpu_cells[*x].attrs.width && self->gpu_cells[*x-1].attrs.width == 2) (*x)--;
|
if (*x > 0 && !self->gpu_cells[*x].attrs.width && self->gpu_cells[*x-1].attrs.width == 2) (*x)--;
|
||||||
*fg = resolve_color(cp, self->gpu_cells[*x].fg, *fg);
|
*fg = resolve_color(cp, self->gpu_cells[*x].fg, *fg);
|
||||||
*bg = resolve_color(cp, self->gpu_cells[*x].bg, *bg);
|
*bg = resolve_color(cp, self->gpu_cells[*x].bg, *bg);
|
||||||
|
if (self->gpu_cells[*x].attrs.reverse) {
|
||||||
|
color_type t = *fg;
|
||||||
|
*fg = *bg;
|
||||||
|
*bg = t;
|
||||||
|
*reversed = true;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -129,4 +129,4 @@ void historybuf_clear(HistoryBuf *self);
|
|||||||
void mark_text_in_line(PyObject *marker, Line *line);
|
void mark_text_in_line(PyObject *marker, Line *line);
|
||||||
bool line_has_mark(Line *, uint16_t mark);
|
bool line_has_mark(Line *, uint16_t mark);
|
||||||
PyObject* as_text_generic(PyObject *args, void *container, get_line_func get_line, index_type lines, ANSIBuf *ansibuf, bool add_trailing_newline);
|
PyObject* as_text_generic(PyObject *args, void *container, get_line_func get_line, index_type lines, ANSIBuf *ansibuf, bool add_trailing_newline);
|
||||||
bool colors_for_cell(Line *self, ColorProfile *cp, index_type *x, color_type *fg, color_type *bg);
|
bool colors_for_cell(Line *self, ColorProfile *cp, index_type *x, color_type *fg, color_type *bg, bool *reversed);
|
||||||
|
|||||||
@ -2227,10 +2227,11 @@ get_line_edge_colors(Screen *self, color_type *left, color_type *right) {
|
|||||||
color_type left_cell_fg = OPT(foreground), left_cell_bg = OPT(background), right_cell_bg = OPT(background), right_cell_fg = OPT(foreground);
|
color_type left_cell_fg = OPT(foreground), left_cell_bg = OPT(background), right_cell_bg = OPT(background), right_cell_fg = OPT(foreground);
|
||||||
index_type cell_color_x = 0;
|
index_type cell_color_x = 0;
|
||||||
char_type left_char = line_get_char(line, cell_color_x);
|
char_type left_char = line_get_char(line, cell_color_x);
|
||||||
colors_for_cell(line, self->color_profile, &cell_color_x, &left_cell_fg, &left_cell_bg);
|
bool reversed = false;
|
||||||
|
colors_for_cell(line, self->color_profile, &cell_color_x, &left_cell_fg, &left_cell_bg, &reversed);
|
||||||
if (line->xnum > 0) cell_color_x = line->xnum - 1;
|
if (line->xnum > 0) cell_color_x = line->xnum - 1;
|
||||||
char_type right_char = line_get_char(line, cell_color_x);
|
char_type right_char = line_get_char(line, cell_color_x);
|
||||||
colors_for_cell(line, self->color_profile, &cell_color_x, &right_cell_fg, &right_cell_bg);
|
colors_for_cell(line, self->color_profile, &cell_color_x, &right_cell_fg, &right_cell_bg, &reversed);
|
||||||
*left = effective_cell_edge_color(left_char, left_cell_fg, left_cell_bg, true);
|
*left = effective_cell_edge_color(left_char, left_cell_fg, left_cell_bg, true);
|
||||||
*right = effective_cell_edge_color(right_char, right_cell_fg, right_cell_bg, false);
|
*right = effective_cell_edge_color(right_char, right_cell_fg, right_cell_bg, false);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -332,9 +332,10 @@ cell_update_uniform_block(ssize_t vao_idx, Screen *screen, int uniform_buffer, c
|
|||||||
color_type cell_fg = rd->default_fg, cell_bg = rd->default_bg;
|
color_type cell_fg = rd->default_fg, cell_bg = rd->default_bg;
|
||||||
index_type cell_color_x = screen->cursor->x;
|
index_type cell_color_x = screen->cursor->x;
|
||||||
bool cursor_ok = screen->cursor->x < screen->columns && screen->cursor->y < screen->lines;
|
bool cursor_ok = screen->cursor->x < screen->columns && screen->cursor->y < screen->lines;
|
||||||
|
bool reversed = false;
|
||||||
if (cursor_ok) {
|
if (cursor_ok) {
|
||||||
linebuf_init_line(screen->linebuf, screen->cursor->y);
|
linebuf_init_line(screen->linebuf, screen->cursor->y);
|
||||||
colors_for_cell(screen->linebuf->line, screen->color_profile, &cell_color_x, &cell_fg, &cell_bg);
|
colors_for_cell(screen->linebuf->line, screen->color_profile, &cell_color_x, &cell_fg, &cell_bg, &reversed);
|
||||||
}
|
}
|
||||||
if (screen->color_profile->overridden.cursor_color.type == COLOR_IS_INDEX || screen->color_profile->overridden.cursor_color.type == COLOR_IS_RGB) {
|
if (screen->color_profile->overridden.cursor_color.type == COLOR_IS_INDEX || screen->color_profile->overridden.cursor_color.type == COLOR_IS_RGB) {
|
||||||
// since the program is controlling the cursor color we hope it has chosen one
|
// since the program is controlling the cursor color we hope it has chosen one
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user