diff --git a/config.def.h b/config.def.h index a723c27..f951881 100644 --- a/config.def.h +++ b/config.def.h @@ -162,10 +162,10 @@ static const char *altcolorname[] = { * Default colors (colorname index) * foreground, background, cursor, reverse cursor */ -unsigned int defaultfg = 258; -unsigned int defaultbg = 259; -unsigned int defaultcs = 256; -static unsigned int defaultrcs = 257; +unsigned int defaultfg = 12; +unsigned int defaultbg = 8; +static unsigned int defaultcs = 14; +static unsigned int defaultrcs = 15; /* * Default shape of cursor diff --git a/config.h b/config.h index 6a01ab3..d322592 100644 --- a/config.h +++ b/config.h @@ -151,7 +151,7 @@ static const char *altcolorname[] = { */ unsigned int defaultfg = 12; unsigned int defaultbg = 8; -unsigned int defaultcs = 14; +static unsigned int defaultcs = 14; static unsigned int defaultrcs = 15; /* diff --git a/st.c b/st.c index 858c2d2..1e72979 100644 --- a/st.c +++ b/st.c @@ -1912,42 +1912,6 @@ csireset(void) memset(&csiescseq, 0, sizeof(csiescseq)); } -void -osc4_color_response(int num) -{ - int n; - char buf[32]; - unsigned char r, g, b; - - if (xgetcolor(num, &r, &g, &b)) { - fprintf(stderr, "erresc: failed to fetch osc4 color %d\n", num); - return; - } - - n = snprintf(buf, sizeof buf, "\033]4;%d;rgb:%02x%02x/%02x%02x/%02x%02x\007", - num, r, r, g, g, b, b); - - ttywrite(buf, n, 1); -} - -void -osc_color_response(int index, int num) -{ - int n; - char buf[32]; - unsigned char r, g, b; - - if (xgetcolor(index, &r, &g, &b)) { - fprintf(stderr, "erresc: failed to fetch osc color %d\n", index); - return; - } - - n = snprintf(buf, sizeof buf, "\033]%d;rgb:%02x%02x/%02x%02x/%02x%02x\007", - num, r, r, g, g, b, b); - - ttywrite(buf, n, 1); -} - void strhandle(void) { @@ -1986,56 +1950,14 @@ strhandle(void) } } return; - case 10: - if (narg < 2) - break; - - p = strescseq.args[1]; - - if (!strcmp(p, "?")) - osc_color_response(defaultfg, 10); - else if (xsetcolorname(defaultfg, p)) - fprintf(stderr, "erresc: invalid foreground color: %s\n", p); - else - redraw(); - return; - case 11: - if (narg < 2) - break; - - p = strescseq.args[1]; - - if (!strcmp(p, "?")) - osc_color_response(defaultbg, 11); - else if (xsetcolorname(defaultbg, p)) - fprintf(stderr, "erresc: invalid background color: %s\n", p); - else - redraw(); - return; - case 12: - if (narg < 2) - break; - - p = strescseq.args[1]; - - if (!strcmp(p, "?")) - osc_color_response(defaultcs, 12); - else if (xsetcolorname(defaultcs, p)) - fprintf(stderr, "erresc: invalid cursor color: %s\n", p); - else - redraw(); - return; case 4: /* color set */ if (narg < 3) break; p = strescseq.args[2]; /* FALLTHROUGH */ - case 104: /* color reset */ + case 104: /* color reset, here p = NULL */ j = (narg > 1) ? atoi(strescseq.args[1]) : -1; - - if (p && !strcmp(p, "?")) - osc4_color_response(j); - else if (xsetcolorname(j, p)) { + if (xsetcolorname(j, p)) { if (par == 104 && narg <= 1) return; /* color reset without parameter */ fprintf(stderr, "erresc: invalid color j=%d, p=%s\n", @@ -2577,10 +2499,6 @@ check_control_code: if (width == 2) { gp->mode |= ATTR_WIDE; if (term.c.x+1 < term.col) { - if (gp[1].mode == ATTR_WIDE && term.c.x+2 < term.col) { - gp[2].u = ' '; - gp[2].mode &= ~ATTR_WDUMMY; - } gp[1].u = '\0'; gp[1].mode = ATTR_WDUMMY; } diff --git a/st.h b/st.h index 363cbb6..079db89 100644 --- a/st.h +++ b/st.h @@ -140,4 +140,3 @@ extern unsigned int defaultfg; extern unsigned int defaultbg; extern const int boxdraw, boxdraw_bold, boxdraw_braille; extern float alpha; -extern unsigned int defaultcs; diff --git a/x.c b/x.c index 965d429..bb0e098 100644 --- a/x.c +++ b/x.c @@ -854,19 +854,6 @@ xloadcols(void) loaded = 1; } -int -xgetcolor(int x, unsigned char *r, unsigned char *g, unsigned char *b) -{ - if (!BETWEEN(x, 0, dc.collen)) - return 1; - - *r = dc.col[x].color.red >> 8; - *g = dc.col[x].color.green >> 8; - *b = dc.col[x].color.blue >> 8; - - return 0; -} - int xsetcolorname(int x, const char *name) {