aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto E. Vargas Caballero <k0ga@shike2.com>2014-04-26 01:45:10 +0200
committerRoberto E. Vargas Caballero <k0ga@shike2.com>2014-04-27 11:30:21 +0200
commit53105cf74fde46229912275c073f8c0f219b05bb (patch)
tree8d9c414df338a133707c48ec7f95796d3f1cc261
parentaa35bbd7a16c6c210a7574a8c45bbe939d5b2922 (diff)
downloadst-53105cf74fde46229912275c073f8c0f219b05bb.tar.gz
st-53105cf74fde46229912275c073f8c0f219b05bb.zip
Remove repeated initialisation of term.esc
Once a sequence is completed term.esc must return to 0, so instead of repeating this expression in all the cases is better put it at the end of the block.
-rw-r--r--st.c24
1 files changed, 6 insertions, 18 deletions
diff --git a/st.c b/st.c
index 124c047..0425c72 100644
--- a/st.c
+++ b/st.c
@@ -2503,10 +2503,10 @@ tputc(char *c, int len) {
2503 csiparse(); 2503 csiparse();
2504 csihandle(); 2504 csihandle();
2505 } 2505 }
2506 return;
2506 } else if(term.esc & ESC_ALTCHARSET) { 2507 } else if(term.esc & ESC_ALTCHARSET) {
2507 tdeftran(ascii); 2508 tdeftran(ascii);
2508 tselcs(); 2509 tselcs();
2509 term.esc = 0;
2510 } else if(term.esc & ESC_TEST) { 2510 } else if(term.esc & ESC_TEST) {
2511 if(ascii == '8') { /* DEC screen alignment test. */ 2511 if(ascii == '8') { /* DEC screen alignment test. */
2512 char E[UTF_SIZ] = "E"; 2512 char E[UTF_SIZ] = "E";
@@ -2517,15 +2517,14 @@ tputc(char *c, int len) {
2517 tsetchar(E, &term.c.attr, x, y); 2517 tsetchar(E, &term.c.attr, x, y);
2518 } 2518 }
2519 } 2519 }
2520 term.esc = 0;
2521 } else { 2520 } else {
2522 switch(ascii) { 2521 switch(ascii) {
2523 case '[': 2522 case '[':
2524 term.esc |= ESC_CSI; 2523 term.esc |= ESC_CSI;
2525 break; 2524 return;
2526 case '#': 2525 case '#':
2527 term.esc |= ESC_TEST; 2526 term.esc |= ESC_TEST;
2528 break; 2527 return;
2529 case 'P': /* DCS -- Device Control String */ 2528 case 'P': /* DCS -- Device Control String */
2530 case '_': /* APC -- Application Program Command */ 2529 case '_': /* APC -- Application Program Command */
2531 case '^': /* PM -- Privacy Message */ 2530 case '^': /* PM -- Privacy Message */
@@ -2534,29 +2533,26 @@ tputc(char *c, int len) {
2534 strreset(); 2533 strreset();
2535 strescseq.type = ascii; 2534 strescseq.type = ascii;
2536 term.esc |= ESC_STR; 2535 term.esc |= ESC_STR;
2537 break; 2536 return;
2538 case '(': /* set primary charset G0 */ 2537 case '(': /* set primary charset G0 */
2539 case ')': /* set secondary charset G1 */ 2538 case ')': /* set secondary charset G1 */
2540 case '*': /* set tertiary charset G2 */ 2539 case '*': /* set tertiary charset G2 */
2541 case '+': /* set quaternary charset G3 */ 2540 case '+': /* set quaternary charset G3 */
2542 term.icharset = ascii - '('; 2541 term.icharset = ascii - '(';
2543 term.esc |= ESC_ALTCHARSET; 2542 term.esc |= ESC_ALTCHARSET;
2544 break; 2543 return;
2545 case 'D': /* IND -- Linefeed */ 2544 case 'D': /* IND -- Linefeed */
2546 if(term.c.y == term.bot) { 2545 if(term.c.y == term.bot) {
2547 tscrollup(term.top, 1); 2546 tscrollup(term.top, 1);
2548 } else { 2547 } else {
2549 tmoveto(term.c.x, term.c.y+1); 2548 tmoveto(term.c.x, term.c.y+1);
2550 } 2549 }
2551 term.esc = 0;
2552 break; 2550 break;
2553 case 'E': /* NEL -- Next line */ 2551 case 'E': /* NEL -- Next line */
2554 tnewline(1); /* always go to first col */ 2552 tnewline(1); /* always go to first col */
2555 term.esc = 0;
2556 break; 2553 break;
2557 case 'H': /* HTS -- Horizontal tab stop */ 2554 case 'H': /* HTS -- Horizontal tab stop */
2558 term.tabs[term.c.x] = 1; 2555 term.tabs[term.c.x] = 1;
2559 term.esc = 0;
2560 break; 2556 break;
2561 case 'M': /* RI -- Reverse index */ 2557 case 'M': /* RI -- Reverse index */
2562 if(term.c.y == term.top) { 2558 if(term.c.y == term.top) {
@@ -2564,46 +2560,38 @@ tputc(char *c, int len) {
2564 } else { 2560 } else {
2565 tmoveto(term.c.x, term.c.y-1); 2561 tmoveto(term.c.x, term.c.y-1);
2566 } 2562 }
2567 term.esc = 0;
2568 break; 2563 break;
2569 case 'Z': /* DECID -- Identify Terminal */ 2564 case 'Z': /* DECID -- Identify Terminal */
2570 ttywrite(VT102ID, sizeof(VT102ID) - 1); 2565 ttywrite(VT102ID, sizeof(VT102ID) - 1);
2571 term.esc = 0;
2572 break; 2566 break;
2573 case 'c': /* RIS -- Reset to inital state */ 2567 case 'c': /* RIS -- Reset to inital state */
2574 treset(); 2568 treset();
2575 term.esc = 0;
2576 xresettitle(); 2569 xresettitle();
2577 xloadcols(); 2570 xloadcols();
2578 break; 2571 break;
2579 case '=': /* DECPAM -- Application keypad */ 2572 case '=': /* DECPAM -- Application keypad */
2580 term.mode |= MODE_APPKEYPAD; 2573 term.mode |= MODE_APPKEYPAD;
2581 term.esc = 0;
2582 break; 2574 break;
2583 case '>': /* DECPNM -- Normal keypad */ 2575 case '>': /* DECPNM -- Normal keypad */
2584 term.mode &= ~MODE_APPKEYPAD; 2576 term.mode &= ~MODE_APPKEYPAD;
2585 term.esc = 0;
2586 break; 2577 break;
2587 case '7': /* DECSC -- Save Cursor */ 2578 case '7': /* DECSC -- Save Cursor */
2588 tcursor(CURSOR_SAVE); 2579 tcursor(CURSOR_SAVE);
2589 term.esc = 0;
2590 break; 2580 break;
2591 case '8': /* DECRC -- Restore Cursor */ 2581 case '8': /* DECRC -- Restore Cursor */
2592 tcursor(CURSOR_LOAD); 2582 tcursor(CURSOR_LOAD);
2593 term.esc = 0;
2594 break; 2583 break;
2595 case '\\': /* ST -- String Terminator */ 2584 case '\\': /* ST -- String Terminator */
2596 if(term.esc & ESC_STR_END) 2585 if(term.esc & ESC_STR_END)
2597 strhandle(); 2586 strhandle();
2598 term.esc = 0;
2599 break; 2587 break;
2600 default: 2588 default:
2601 fprintf(stderr, "erresc: unknown sequence ESC 0x%02X '%c'\n", 2589 fprintf(stderr, "erresc: unknown sequence ESC 0x%02X '%c'\n",
2602 (uchar) ascii, isprint(ascii)? ascii:'.'); 2590 (uchar) ascii, isprint(ascii)? ascii:'.');
2603 term.esc = 0;
2604 break; 2591 break;
2605 } 2592 }
2606 } 2593 }
2594 term.esc = 0;
2607 /* 2595 /*
2608 * All characters which form part of a sequence are not 2596 * All characters which form part of a sequence are not
2609 * printed 2597 * printed