JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
Use tsetdirt in tscrollup and tscrolldown.
[st.git] / st.c
diff --git a/st.c b/st.c
index aba034f..d188b35 100644 (file)
--- a/st.c
+++ b/st.c
@@ -1399,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);
@@ -1419,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);
@@ -2308,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);