[hackers] [st] Normalize the whole color selection in xdrawcursor. || Christoph Lohmann

From: <git_AT_suckless.org>
Date: Tue, 6 Oct 2015 00:22:31 +0200 (CEST)

commit 2ea02c937e3a1810050a5fb9f51e7e522d23af3b
Author: Christoph Lohmann <20h_AT_r-36.net>
AuthorDate: Tue Oct 6 00:21:44 2015 +0200
Commit: Christoph Lohmann <20h_AT_r-36.net>
CommitDate: Tue Oct 6 00:21:44 2015 +0200

    Normalize the whole color selection in xdrawcursor.

diff --git a/st.c b/st.c
index d9f0ba6..e885a7d 100644
--- a/st.c
+++ b/st.c
_AT_@ -3850,12 +3850,29 @@ 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.fg = defaultfg;
- g.bg = defaultrcs;
+
+ /*
+ * 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];
+ g.fg = defaultfg;
+ if (ena_sel && selected(term.c.x, term.c.y)) {
+ g.bg = defaultcs;
+ drawcol = dc.col[defaultrcs];
+ } else {
+ drawcol = dc.col[defaultcs];
+ g.bg = defaultrcs;
+ }
         }
 
         if (IS_SET(MODE_HIDE))
_AT_@ -3869,12 +3886,6 @@ xdrawcursor(void)
                 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;
Received on Tue Oct 06 2015 - 00:22:31 CEST

This archive was generated by hypermail 2.3.0 : Tue Oct 06 2015 - 00:24:12 CEST