aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJules Maselbas <jules.maselbas@grenoble-inp.org>2018-07-15 13:53:37 +0200
committerHiltjo Posthuma <hiltjo@codemadness.org>2018-07-15 18:16:52 +0200
commit5535c1f04c665c05faff2a65d5558246b7748d49 (patch)
tree88f6a4d989b1ad7a4355fcdd2ef8bfb965dab315
parentb51bcd5553af3db394014efbd78acf7828fa48ff (diff)
downloadst-5535c1f04c665c05faff2a65d5558246b7748d49.tar.gz
st-5535c1f04c665c05faff2a65d5558246b7748d49.tar.bz2
Fix crash when cursor color is truecolor
Reported-by: Ivan Tham <pickfire@riseup.net>
-rw-r--r--x.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/x.c b/x.c
index b51821d..4155a70 100644
--- a/x.c
+++ b/x.c
@@ -1404,6 +1404,7 @@ void
xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og)
{
Color drawcol;
+ uint32_t cc;
/* remove the old cursor */
if (selected(ox, oy))
@@ -1419,14 +1420,22 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og)
g.mode &= ATTR_BOLD|ATTR_ITALIC|ATTR_UNDERLINE|ATTR_STRUCK|ATTR_WIDE;
if (selected(cx, cy)) {
- drawcol = dc.col[g.bg];
+ cc = g.bg;
} else {
g.mode |= ATTR_REVERSE;
-
if (g.mode & ATTR_BOLD && BETWEEN(g.fg, 0, 7))
- drawcol = dc.col[g.fg + 8];
+ cc = g.fg + 8;
else
- drawcol = dc.col[g.fg];
+ cc = g.fg;
+ }
+
+ if (IS_TRUECOL(cc)) {
+ drawcol.color.alpha = 0xffff;
+ drawcol.color.red = TRUERED(cc);
+ drawcol.color.green = TRUEGREEN(cc);
+ drawcol.color.blue = TRUEBLUE(cc);
+ } else {
+ drawcol = dc.col[cc];
}
if (IS_SET(MODE_REVERSE)) {