all repos — st @ b51bcd5553af3db394014efbd78acf7828fa48ff

st (suckless terminal) config

Make cursor follow text color
Jules Maselbas jules.maselbas@grenoble-inp.org
commit

b51bcd5553af3db394014efbd78acf7828fa48ff

parent

1911c9274d9b03f3d7999c6ce26e2d5169642d26

2 files changed, 7 insertions(+), 7 deletions(-)

jump to
M config.def.hconfig.def.h

@@ -118,8 +118,6 @@ * foreground, background, cursor, reverse cursor

*/ unsigned int defaultfg = 7; unsigned int defaultbg = 0; -static unsigned int defaultcs = 256; -static unsigned int defaultrcs = 257; /* * Default shape of cursor
M x.cx.c

@@ -1419,13 +1419,15 @@ */

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;