Fix the cursor colors selection
[st.git] / st.c
diff --git a/st.c b/st.c
index 782d18e..01d4410 100644 (file)
--- a/st.c
+++ b/st.c
@@ -3850,11 +3850,28 @@ xdrawcursor(void)
        xdrawglyph(og, oldx, oldy);
 
        g.u = term.line[term.c.y][term.c.x].u;
-       if (ena_sel && selected(term.c.x, term.c.y)) {
-               drawcol = dc.col[defaultrcs];
-               g.mode ^= ATTR_REVERSE;
+
+       /*
+        * Select the right color for the right mode.
+        */
+       if (IS_SET(MODE_REVERSE)) {
+               g.mode |= ATTR_REVERSE;
+               g.bg = defaultfg;
+               if (ena_sel && selected(term.c.x, term.c.y)) {
+                       drawcol = dc.col[defaultcs];
+                       g.fg = defaultrcs;
+               } else {
+                       drawcol = dc.col[defaultrcs];
+                       g.fg = defaultcs;
+               }
        } else {
-               drawcol = dc.col[defaultcs];
+               if (ena_sel && selected(term.c.x, term.c.y)) {
+                       drawcol = dc.col[defaultrcs];
+                       g.fg = defaultfg;
+                       g.bg = defaultrcs;
+               } else {
+                       drawcol = dc.col[defaultcs];
+               }
        }
 
        if (IS_SET(MODE_HIDE))
@@ -3863,15 +3880,11 @@ xdrawcursor(void)
        /* draw the new one */
        if (xw.state & WIN_FOCUSED) {
                switch (xw.cursor) {
+               case 7: /* st extension: snowman */
+                       utf8decode("☃", &g.u, UTF_SIZ);
                case 0: /* Blinking Block */
                case 1: /* Blinking Block (Default) */
                case 2: /* Steady Block */
-                       if (IS_SET(MODE_REVERSE)) {
-                               g.mode |= ATTR_REVERSE;
-                               g.fg = defaultcs;
-                               g.bg = defaultfg;
-                       }
-
                        g.mode |= term.line[term.c.y][curx].mode & ATTR_WIDE;
                        xdrawglyph(g, term.c.x, term.c.y);
                        break;