JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
Moving the alt declaration to the beginning of the function.
[st.git] / st.c
diff --git a/st.c b/st.c
index 657fba7..2919082 100644 (file)
--- a/st.c
+++ b/st.c
@@ -1459,6 +1459,7 @@ tsetscroll(int t, int b) {
 void
 tsetmode(bool priv, bool set, int *args, int narg) {
        int *lim, mode;
+       bool alt;
 
        for(lim = args + narg; args < lim; ++args) {
                if(priv) {
@@ -1480,9 +1481,14 @@ tsetmode(bool priv, bool set, int *args, int narg) {
                        case 7: /* DECAWM -- Auto wrap */
                                MODBIT(term.mode, set, MODE_WRAP);
                                break;
-                       case 8: /* XXX: DECARM -- Auto repeat */
-                               break;
                        case 0:  /* Error (IGNORED) */
+                       case 2:  /* DECANM -- ANSI/VT52 (IGNORED) */
+                       case 3:  /* DECCOLM -- Column  (IGNORED) */
+                       case 4:  /* DECSCLM -- Scroll (IGNORED) */
+                       case 8:  /* DECARM -- Auto repeat (IGNORED) */
+                       case 18: /* DECPFF -- Printer feed (IGNORED) */
+                       case 19: /* DECPEX -- Printer extent (IGNORED) */
+                       case 42: /* DECNRCM -- National characters (IGNORED) */
                        case 12: /* att610 -- Start blinking cursor (IGNORED) */
                                break;
                        case 25: /* DECTCEM -- Text Cursor Enable Mode */
@@ -1497,7 +1503,7 @@ tsetmode(bool priv, bool set, int *args, int narg) {
                        case 1049: /* = 1047 and 1048 */
                        case 47:
                        case 1047: {
-                               bool alt = IS_SET(MODE_ALTSCREEN) != 0;
+                               alt = IS_SET(MODE_ALTSCREEN) != 0;
                                if(alt)
                                        tclearregion(0, 0, term.col-1, term.row-1);
                                if(set ^ alt)           /* set is always 1 or 0 */
@@ -1510,12 +1516,6 @@ tsetmode(bool priv, bool set, int *args, int narg) {
                                tcursor((set) ? CURSOR_SAVE : CURSOR_LOAD);
                                break;
                        default:
-                       /* case 2:  DECANM -- ANSI/VT52 (NOT SUPPOURTED) */
-                       /* case 3:  DECCOLM -- Column  (NOT SUPPORTED) */
-                       /* case 4:  DECSCLM -- Scroll (NOT SUPPORTED) */
-                       /* case 18: DECPFF -- Printer feed (NOT SUPPORTED) */
-                       /* case 19: DECPEX -- Printer extent (NOT SUPPORTED) */
-                       /* case 42: DECNRCM -- National characters (NOT SUPPORTED) */
                                fprintf(stderr,
                                        "erresc: unknown private set/reset mode %d\n",
                                        *args);
@@ -1562,11 +1562,11 @@ csihandle(void) {
                tinsertblank(csiescseq.arg[0]);
                break;
        case 'A': /* CUU -- Cursor <n> Up */
-       case 'e':
                DEFAULT(csiescseq.arg[0], 1);
                tmoveto(term.c.x, term.c.y-csiescseq.arg[0]);
                break;
        case 'B': /* CUD -- Cursor <n> Down */
+       case 'e': /* VPR --Cursor <n> Down */
                DEFAULT(csiescseq.arg[0], 1);
                tmoveto(term.c.x, term.c.y+csiescseq.arg[0]);
                break;
@@ -1575,7 +1575,7 @@ csihandle(void) {
                        ttywrite(VT102ID, sizeof(VT102ID) - 1);
                break;
        case 'C': /* CUF -- Cursor <n> Forward */
-       case 'a':
+       case 'a': /* HPR -- Cursor <n> Forward */
                DEFAULT(csiescseq.arg[0], 1);
                tmoveto(term.c.x+csiescseq.arg[0], term.c.y);
                break;