X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=st.c;h=70caf8294cd4773b19e483bb78597572a2f1c2c1;hb=b8d6171cb00c28e4c90e58e101554097003b59d3;hp=e20a1e0691fb74019b5aeb75a969e82a9df063cd;hpb=45b808b88ee63f21a188800ba3473a24a3c4b987;p=st.git diff --git a/st.c b/st.c index e20a1e0..70caf82 100644 --- a/st.c +++ b/st.c @@ -1257,7 +1257,7 @@ ttyread(void) { /* process every complete utf8 char */ buflen += ret; ptr = buf; - while(charsize = utf8decode(ptr, &unicodep, buflen)) { + while((charsize = utf8decode(ptr, &unicodep, buflen))) { utf8encode(unicodep, s, UTF_SIZ); tputc(s, charsize); ptr += charsize; @@ -1855,7 +1855,10 @@ tsetmode(bool priv, bool set, int *args, int narg) { MODBIT(term.mode, set, MODE_8BIT); break; case 1049: /* swap screen & set/restore cursor as xterm */ + if (!allowaltscreen) + break; tcursor((set) ? CURSOR_SAVE : CURSOR_LOAD); + /* FALLTHRU */ case 47: /* swap screen */ case 1047: if (!allowaltscreen) @@ -2263,9 +2266,10 @@ tdumpsel(void) { char *ptr; - ptr = getsel(); - tprinter(ptr, strlen(ptr)); - free(ptr); + if((ptr = getsel())) { + tprinter(ptr, strlen(ptr)); + free(ptr); + } } void @@ -3088,7 +3092,7 @@ xinit(void) { xresettitle(); XMapWindow(xw.dpy, xw.win); xhints(); - XSync(xw.dpy, 0); + XSync(xw.dpy, False); } void @@ -3439,7 +3443,6 @@ void redraw(int timeout) { struct timespec tv = {0, timeout * 1000}; - tfulldirt(); draw(); if(timeout > 0) { @@ -3737,8 +3740,8 @@ run(void) { else cresize(xw.fw, xw.fh); - gettimeofday(&lastblink, NULL); gettimeofday(&last, NULL); + lastblink = last; for(xev = actionfps;;) { long deltatime; @@ -3773,7 +3776,7 @@ run(void) { if(blinktimeout && TIMEDIFF(now, lastblink) > blinktimeout) { tsetdirtattr(ATTR_BLINK); term.mode ^= MODE_BLINK; - gettimeofday(&lastblink, NULL); + lastblink = now; dodraw = 1; } deltatime = TIMEDIFF(now, last);