X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=st.c;h=d188b355cc2f512dd17c72fda746da9dd8b6181e;hb=3afdb4ff04b45a5e4209a56d5073341c9d506b38;hp=bb3e68748ef508d3a5f2536aa997423518775643;hpb=df1810dd8fcb7a14f4cd2ff2ec3ce8780591f87f;p=st.git diff --git a/st.c b/st.c index bb3e687..d188b35 100644 --- a/st.c +++ b/st.c @@ -549,12 +549,10 @@ xrealloc(void *p, size_t len) { char * xstrdup(char *s) { - char *p = strdup(s); - - if (!p) + if((s = strdup(s)) == NULL) die("Out of memory\n"); - return p; + return s; } size_t @@ -1401,14 +1399,13 @@ tscrolldown(int orig, int n) { LIMIT(n, 0, term.bot-orig+1); tclearregion(0, term.bot-n+1, term.col-1, term.bot); + tsetdirt(orig, term.bot-n); + tsetdirt(orig+n, term.bot); for(i = term.bot; i >= orig+n; i--) { temp = term.line[i]; term.line[i] = term.line[i-n]; term.line[i-n] = temp; - - term.dirty[i] = 1; - term.dirty[i-n] = 1; } selscroll(orig, n); @@ -1421,14 +1418,13 @@ tscrollup(int orig, int n) { LIMIT(n, 0, term.bot-orig+1); tclearregion(0, orig, term.col-1, orig+n-1); + tsetdirt(orig, term.bot-n); + tsetdirt(orig+n, term.bot); for(i = orig; i <= term.bot-n; i++) { temp = term.line[i]; term.line[i] = term.line[i+n]; term.line[i+n] = temp; - - term.dirty[i] = 1; - term.dirty[i+n] = 1; } selscroll(orig, -n); @@ -2310,9 +2306,9 @@ techo(char *buf, int len) { for(; len > 0; buf++, len--) { char c = *buf; - if(c < '\x20') { /* control code */ + if(c < 0x20 || c == 0177) { /* control code */ if(c != '\n' && c != '\r' && c != '\t') { - c |= '\x40'; + c ^= '\x40'; tputc("^", 1); } tputc(&c, 1);