st

simple terminal

git clone https://9o.is/git/st.git

commit 7e6596f2974870e7e629be38f806a098ef3ba376
parent 0b6b343e49934c35692117a33974f14f85f67f6e
Author: Jul <jul@9o.is>
Date:   Tue, 15 Jul 2025 18:06:43 -0400

add dynamic cursor color patch

Diffstat:
Mx.c | 17++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/x.c b/x.c @@ -1523,6 +1523,7 @@ void xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og) { Color drawcol; + XRenderColor colbg; /* remove the old cursor */ if (selected(ox, oy)) @@ -1551,11 +1552,21 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og) if (selected(cx, cy)) { g.fg = defaultfg; g.bg = defaultrcs; + } else if (!(og.mode & ATTR_REVERSE)) { + unsigned long col = g.bg; + g.bg = g.fg; + g.fg = col; + } + + if (IS_TRUECOL(g.bg)) { + colbg.alpha = 0xffff; + colbg.red = TRUERED(g.bg); + colbg.green = TRUEGREEN(g.bg); + colbg.blue = TRUEBLUE(g.bg); + XftColorAllocValue(xw.dpy, xw.vis, xw.cmap, &colbg, &drawcol); } else { - g.fg = defaultbg; - g.bg = defaultcs; + drawcol = dc.col[g.bg]; } - drawcol = dc.col[g.bg]; } /* draw the new one */