[hackers] [st][PATCH v2 2/2] Make cursor follow text color

From: Jules Maselbas <jules.maselbas_AT_grenoble-inp.org>
Date: Sat, 14 Jul 2018 11:16:37 +0200

---
 config.def.h |  2 --
 x.c          | 12 +++++++-----
 2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/config.def.h b/config.def.h
index 82b1b09..ca6b0db 100644
--- a/config.def.h
+++ b/config.def.h
_AT_@ -118,8 +118,6 @@ static const char *colorname[] = {
  */
 unsigned int defaultfg = 7;
 unsigned int defaultbg = 0;
-static unsigned int defaultcs = 256;
-static unsigned int defaultrcs = 257;
 
 /*
  * Default shape of cursor
diff --git a/x.c b/x.c
index d8ca4d4..8be043f 100644
--- a/x.c
+++ b/x.c
_AT_@ -1415,13 +1415,15 @@ 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)) {
-		g.bg = defaultrcs;
-		g.fg = defaultfg;
+		drawcol = dc.col[g.bg];
 	} else {
-		g.bg = defaultcs;
-		g.fg = defaultbg;
+		g.mode |= ATTR_REVERSE;
+
+		if (g.mode & ATTR_BOLD && BETWEEN(g.fg, 0, 7))
+			drawcol = dc.col[g.fg + 8];
+		else
+			drawcol = dc.col[g.fg];
 	}
-	drawcol = dc.col[g.bg];
 
 	if (IS_SET(MODE_REVERSE)) {
 		drawcol.color.red = ~drawcol.color.red;
-- 
2.18.0
Received on Sat Jul 14 2018 - 11:16:37 CEST

This archive was generated by hypermail 2.3.0 : Sat Jul 14 2018 - 11:24:20 CEST