X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=st.c;h=2a565b6e96e7d1c3692a2dd5ed18331981a24b37;hb=9619760e129b0994cd3bc4c827c83960f6a5e98f;hp=05585937dd19b023d51c7e7800f595b366316f0a;hpb=9d1495f9eeee993a480c7ab1755803d081d794e6;p=st.git diff --git a/st.c b/st.c index 0558593..2a565b6 100644 --- a/st.c +++ b/st.c @@ -1571,11 +1571,9 @@ tmoveto(int x, int y) { miny = 0; maxy = term.row - 1; } - LIMIT(x, 0, term.col-1); - LIMIT(y, miny, maxy); term.c.state &= ~CURSOR_WRAPNEXT; - term.c.x = x; - term.c.y = y; + term.c.x = LIMIT(x, 0, term.col-1); + term.c.y = LIMIT(y, miny, maxy); } void @@ -2446,21 +2444,19 @@ tdectest(char c) { void tstrsequence(uchar c) { - if (c & 0x80) { - switch (c) { - case 0x90: /* DCS -- Device Control String */ - c = 'P'; - break; - case 0x9f: /* APC -- Application Program Command */ - c = '_'; - break; - case 0x9e: /* PM -- Privacy Message */ - c = '^'; - break; - case 0x9d: /* OSC -- Operating System Command */ - c = ']'; - break; - } + switch (c) { + case 0x90: /* DCS -- Device Control String */ + c = 'P'; + break; + case 0x9f: /* APC -- Application Program Command */ + c = '_'; + break; + case 0x9e: /* PM -- Privacy Message */ + c = '^'; + break; + case 0x9d: /* OSC -- Operating System Command */ + c = ']'; + break; } strreset(); strescseq.type = c; @@ -2787,10 +2783,8 @@ tresize(int col, int row) { free(term.line[i]); free(term.alt[i]); } - if(i > 0) { - memmove(term.line, term.line + i, row * sizeof(Line)); - memmove(term.alt, term.alt + i, row * sizeof(Line)); - } + memmove(term.line, term.line + i, row * sizeof(Line)); + memmove(term.alt, term.alt + i, row * sizeof(Line)); for(i += row; i < term.row; i++) { free(term.line[i]); free(term.alt[i]); @@ -4014,7 +4008,6 @@ usage(void) { int main(int argc, char *argv[]) { - char *titles; uint cols = 80, rows = 24; xw.l = xw.t = 0; @@ -4032,10 +4025,8 @@ main(int argc, char *argv[]) { /* eat all remaining arguments */ if(argc > 1) { opt_cmd = &argv[1]; - if(argv[1] != NULL && opt_title == NULL) { - titles = xstrdup(argv[1]); - opt_title = basename(titles); - } + if(argv[1] != NULL && opt_title == NULL) + opt_title = basename(xstrdup(argv[1])); } goto run; case 'f':