X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=st.c;h=ff9bdd81e942c6767e7d54e8f71afb8c5ead95a1;hb=1b0b9759dca9739da04f5c8a206b2f8ee5ed8b25;hp=2741ef8edcee0737fa2a59368d829ba11af90a2d;hpb=fe31a3f6344b0a1dbe72540aad63812f1edb6c12;p=st.git diff --git a/st.c b/st.c index 2741ef8..ff9bdd8 100644 --- a/st.c +++ b/st.c @@ -2751,10 +2751,10 @@ int xsetcolorname(int x, const char *name) { XRenderColor color = { .alpha = 0xffff }; Colour colour; - if (x < 0 || x > LEN(colorname)) + if(!BETWEEN(x, 0, LEN(colorname))) return -1; if(!name) { - if(16 <= x && x < 16 + 216) { + if(BETWEEN(x, 16, 16 + 215)) { int r = (x - 16) / 36, g = ((x - 16) % 36) / 6, b = (x - 16) % 6; color.red = sixd_to_16bit(r); color.green = sixd_to_16bit(g); @@ -2763,7 +2763,7 @@ xsetcolorname(int x, const char *name) { return 0; /* something went wrong */ dc.col[x] = colour; return 1; - } else if (16 + 216 <= x && x < 256) { + } else if(BETWEEN(x, 16 + 216, 255)) { color.red = color.green = color.blue = 0x0808 + 0x0a0a * (x - (16 + 216)); if(!XftColorAllocValue(xw.dpy, xw.vis, xw.cmap, &color, &colour)) return 0; /* something went wrong */ @@ -3457,7 +3457,7 @@ drawregion(int x1, int y1, int x2, int y2) { bool ena_sel = sel.ob.x != -1; long unicodep; - if(sel.alt ^ IS_SET(MODE_ALTSCREEN)) + if(sel.alt != IS_SET(MODE_ALTSCREEN)) ena_sel = 0; if(!(xw.state & WIN_VISIBLE))