st

my build of st
git clone git://git.ckyln.com/st
Log | Files | Refs | README | LICENSE

commit 03ae6f2c0ee9d2eef4b9b5f82e8e1fdd6e4abfdf
parent 46a40b7273e268de623fa0ff669f46adc0f99bd9
Author: Cem Keylan <cem@ckyln.com>
Date:   Tue,  4 Aug 2020 16:11:26 +0300

add compatibility for paleta

Diffstat:
Mconfig.def.h | 8++++----
Mst.c | 21+++++++++++++++++----
Mst.h | 1+
3 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/config.def.h b/config.def.h @@ -131,10 +131,10 @@ static const char *colorname[] = { * Default colors (colorname index) * foreground, background, cursor, reverse cursor */ -unsigned int defaultfg = 7; -unsigned int defaultbg = 258; -static unsigned int defaultcs = 256; -static unsigned int defaultrcs = 257; +unsigned int defaultfg = 257; +unsigned int defaultbg = 256; +unsigned int defaultcs = 257; +unsigned int defaultrcs = 257; /* * Default shape of cursor diff --git a/st.c b/st.c @@ -1932,12 +1932,23 @@ strhandle(void) } return; case 4: /* color set */ - if (narg < 3) + case 10: /* foreground set */ + case 11: /* background set */ + case 12: /* cursor color */ + if ((par == 4 && narg < 3) || narg < 2) break; - p = strescseq.args[2]; + p = strescseq.args[((par == 4) ? 2 : 1)]; /* FALLTHROUGH */ case 104: /* color reset, here p = NULL */ - j = (narg > 1) ? atoi(strescseq.args[1]) : -1; + if (par == 10) + j = defaultfg; + else if (par == 11) + j = defaultbg; + else if (par == 12) + j = defaultcs; + else + j = (narg > 1) ? atoi(strescseq.args[1]) : -1; + if (xsetcolorname(j, p)) { if (par == 104 && narg <= 1) return; /* color reset without parameter */ @@ -1948,7 +1959,9 @@ strhandle(void) * TODO if defaultbg color is changed, borders * are dirty */ - redraw(); + if (j != 0 && j != 15) { + redraw(); + } } return; } diff --git a/st.h b/st.h @@ -126,4 +126,5 @@ extern char *termname; extern unsigned int tabspaces; extern unsigned int defaultfg; extern unsigned int defaultbg; +extern unsigned int defaultcs; extern float alpha;