X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=st.c;h=6a9017613bf5c69df4e306d0f844e6a288d23569;hb=160bda1b60148ce8f7d3b001ada2b12f1da9e152;hp=864dfc7179c1c6171ab2fcea74e09a2a5698e012;hpb=0ba53e48c76a2a2668dfa270cfd0227461c3a91b;p=st.git diff --git a/st.c b/st.c index 864dfc7..6a90176 100644 --- a/st.c +++ b/st.c @@ -213,10 +213,10 @@ static inline int selected(int x, int y) { if ((seley==y && selby==y)) { int bx = MIN(selbx, selex); int ex = MAX(selbx, selex); - return if(x>=bx && x<=ex) + return (x>=bx && x<=ex); } return (((y>sb[1] && y=sb[0] && (x<=se[0] || sb[1]!=se[1]))) + (y==sb[1] && x>=sb[0] && (x<=se[0] || sb[1]!=se[1]))); } static void getbuttoninfo(XEvent *e, int *b, int *x, int *y) { @@ -331,7 +331,7 @@ die(const char *errstr, ...) { void execsh(void) { char *args[3] = {getenv("SHELL"), "-i", NULL}; - DEFAULT(args[0], "/bin/sh"); /* if getenv() failed */ + DEFAULT(args[0], SHELL); /* if getenv() failed */ putenv("TERM=" TNAME); execvp(args[0], args); } @@ -828,22 +828,17 @@ csihandle(void) { case 25: term.c.state |= CURSOR_HIDE; break; + case 1049: /* = 1047 and 1048 */ case 1047: if(IS_SET(MODE_ALTSCREEN)) { tclearregion(0, 0, term.col-1, term.row-1); tswapscreen(); } - break; + if(escseq.arg[0] == 1047) + break; case 1048: tcursor(CURSOR_LOAD); break; - case 1049: - tcursor(CURSOR_LOAD); - if(IS_SET(MODE_ALTSCREEN)) { - tclearregion(0, 0, term.col-1, term.row-1); - tswapscreen(); - } - break; default: goto unknown; } @@ -888,22 +883,17 @@ csihandle(void) { case 25: term.c.state &= ~CURSOR_HIDE; break; + case 1049: /* = 1047 and 1048 */ case 1047: if(IS_SET(MODE_ALTSCREEN)) tclearregion(0, 0, term.col-1, term.row-1); else tswapscreen(); - break; + if(escseq.arg[0] == 1047) + break; case 1048: tcursor(CURSOR_SAVE); break; - case 1049: - tcursor(CURSOR_SAVE); - if(IS_SET(MODE_ALTSCREEN)) - tclearregion(0, 0, term.col-1, term.row-1); - else - tswapscreen(); - break; default: goto unknown; } } else { @@ -1222,6 +1212,7 @@ xinit(void) { xw.bufw = xw.w - 2*BORDER; xw.bufh = xw.h - 2*BORDER; xw.buf = XCreatePixmap(xw.dis, xw.win, xw.bufw, xw.bufh, XDefaultDepth(xw.dis, xw.scr)); + xw.hasfocus = 1; /* gc */ dc.gc = XCreateGC(xw.dis, xw.win, 0, NULL); XMapWindow(xw.dis, xw.win); @@ -1322,7 +1313,7 @@ draw(int redraw_all) { for(x = 0; x < term.col; x++) { new = term.line[y][x]; if(selbx!=-1 && new.c && selected(x, y)) - new.mode = ATTR_REVERSE; + new.mode ^= ATTR_REVERSE; if(i > 0 && (!(new.state & GLYPH_SET) || ATTRCMP(base, new) || i >= DRAW_BUF_SIZ)) { xdraws(buf, base, ox, y, i);