mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
render: never apply alpha to text color
When drawing a block cursor using inversed fg/bg colors, we didn’t strip the alpha from the background color. This meant that the text "behind" the cursor was rendered with transparency. If alpha was set to 0, the text was completely invisible. We should never apply alpha to the text color. So, detect this, and force alpha to 1.0. Normally, when selecting the cursor’s color, we don’t really know _where_ the background color is coming from (or more accurately, _what_ it is). However, the *only* background color that can have a non-1.0 alpha is the *default* background color. This is why we can ignore the bg parameter, and use term->colors.fg/bg instead. Closes #1205
This commit is contained in:
parent
49fa751953
commit
2c2a39317b
2 changed files with 12 additions and 1 deletions
|
|
@ -91,9 +91,13 @@
|
|||
* Crash when a sixel image exceeds the current sixel max height.
|
||||
* Crash after reverse-scrolling (`CSI Ps T`) in the ‘normal’
|
||||
(non-alternate) screen ([#1190][1190]).
|
||||
* Background transparency being applied to the text "behind" the
|
||||
cursor. Only applies to block cursor using inversed fg/bg
|
||||
colors. ([#1205][1205]).
|
||||
|
||||
[1173]: https://codeberg.org/dnkl/foot/issues/1173
|
||||
[1190]: https://codeberg.org/dnkl/foot/issues/1190
|
||||
[1205]: https://codeberg.org/dnkl/foot/issues/1205
|
||||
|
||||
|
||||
### Security
|
||||
|
|
|
|||
9
render.c
9
render.c
|
|
@ -419,7 +419,14 @@ cursor_colors_for_cell(const struct terminal *term, const struct cell *cell,
|
|||
}
|
||||
} else {
|
||||
*cursor_color = *fg;
|
||||
*text_color = *bg;
|
||||
|
||||
if (unlikely(text_color->alpha != 0xffff)) {
|
||||
/* We *know* this only happens when bg is the default bg
|
||||
* color */
|
||||
*text_color = color_hex_to_pixman(
|
||||
term->reverse ? term->colors.fg : term->colors.bg);
|
||||
} else
|
||||
*text_color = *bg;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue