]> Sergey Matveev's repositories - st.git/blobdiff - st.c
config.def.h: improve latency for the default configuration
[st.git] / st.c
diff --git a/st.c b/st.c
index d6478f55a2498f36bc1c0fa54bdff5de94e1b114..683493d3aa66fc346eb0eadc1c6e8f8bdd08dac8 100644 (file)
--- a/st.c
+++ b/st.c
@@ -86,8 +86,8 @@ enum escape_state {
 
 typedef struct {
        Glyph attr; /* current char attributes */
-       int x;
-       int y;
+       int x; /* terminal column */
+       int y; /* terminal row */
        char state;
 } TCursor;
 
@@ -1643,7 +1643,7 @@ csihandle(void)
                        ttywrite(vtiden, strlen(vtiden), 0);
                break;
        case 'b': /* REP -- if last char is printable print it <n> more times */
-               DEFAULT(csiescseq.arg[0], 1);
+               LIMIT(csiescseq.arg[0], 1, 65535);
                if (term.lastc)
                        while (csiescseq.arg[0]-- > 0)
                                tputc(term.lastc);
@@ -1728,6 +1728,7 @@ csihandle(void)
                }
                break;
        case 'S': /* SU -- Scroll <n> line up */
+               if (csiescseq.priv) break;
                DEFAULT(csiescseq.arg[0], 1);
                tscrollup(term.top, csiescseq.arg[0]);
                break;
@@ -2174,12 +2175,16 @@ tstrsequence(uchar c)
 void
 tcontrolcode(uchar ascii)
 {
+       size_t i;
+
        switch (ascii) {
        case '\t':   /* HT */
                tputtab(1);
                return;
        case '\b':   /* BS */
-               tmoveto(term.c.x-1, term.c.y);
+               for (i = 1; term.c.x && term.line[term.c.y][term.c.x - i].u == 0; ++i)
+                       ;
+               tmoveto(term.c.x - i, term.c.y);
                return;
        case '\r':   /* CR */
                tmoveto(0, term.c.y);