]> Sergey Matveev's repositories - st.git/blobdiff - st.c
Optimisations
[st.git] / st.c
diff --git a/st.c b/st.c
index 683493d3aa66fc346eb0eadc1c6e8f8bdd08dac8..57c6e962ac778da43795ed855035b4554ebd02cf 100644 (file)
--- a/st.c
+++ b/st.c
@@ -86,8 +86,8 @@ enum escape_state {
 
 typedef struct {
        Glyph attr; /* current char attributes */
-       int x; /* terminal column */
-       int y; /* terminal row */
+       int x;
+       int y;
        char state;
 } TCursor;
 
@@ -1132,6 +1132,7 @@ csiparse(void)
 {
        char *p = csiescseq.buf, *np;
        long int v;
+       int sep = ';'; /* colon or semi-colon, but not both */
 
        csiescseq.narg = 0;
        if (*p == '?') {
@@ -1149,7 +1150,9 @@ csiparse(void)
                        v = -1;
                csiescseq.arg[csiescseq.narg++] = v;
                p = np;
-               if (*p != ';' || csiescseq.narg == ESC_ARG_SIZ)
+               if (sep == ';' && *p == ':')
+                       sep = ':'; /* allow override to colon once */
+               if (*p != sep || csiescseq.narg == ESC_ARG_SIZ)
                        break;
                p++;
        }
@@ -2175,16 +2178,12 @@ tstrsequence(uchar c)
 void
 tcontrolcode(uchar ascii)
 {
-       size_t i;
-
        switch (ascii) {
        case '\t':   /* HT */
                tputtab(1);
                return;
        case '\b':   /* BS */
-               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);
+               tmoveto(term.c.x-1, term.c.y);
                return;
        case '\r':   /* CR */
                tmoveto(0, term.c.y);