Fix displaying control code

Control code are never displayed. It is not important if graphic
charset is displayed or not.
This commit is contained in:
Roberto E. Vargas Caballero 2014-04-29 09:58:55 +02:00
parent 1629363f2d
commit 870f961c49

20
st.c
View file

@ -392,7 +392,7 @@ static void tsetdirtattr(int);
static void tsetmode(bool, bool, int *, int); static void tsetmode(bool, bool, int *, int);
static void tfulldirt(void); static void tfulldirt(void);
static void techo(char *, int); static void techo(char *, int);
static bool tcontrolcode(uchar ); static void tcontrolcode(uchar );
static void tdectest(char ); static void tdectest(char );
static int32_t tdefcolor(int *, int *, int); static int32_t tdefcolor(int *, int *, int);
static void tdeftran(char); static void tdeftran(char);
@ -2328,7 +2328,7 @@ tdeftran(char ascii) {
term.trantbl[term.icharset] = (*bp)[1]; term.trantbl[term.icharset] = (*bp)[1];
} }
bool void
tcontrolcode(uchar ascii) { tcontrolcode(uchar ascii) {
static char question[UTF_SIZ] = "?"; static char question[UTF_SIZ] = "?";
@ -2363,7 +2363,7 @@ tcontrolcode(uchar ascii) {
csireset(); csireset();
term.esc &= ~(ESC_CSI|ESC_ALTCHARSET|ESC_TEST); term.esc &= ~(ESC_CSI|ESC_ALTCHARSET|ESC_TEST);
term.esc |= ESC_START; term.esc |= ESC_START;
return 1; return;
case '\016': /* SO */ case '\016': /* SO */
term.charset = 0; term.charset = 0;
break; break;
@ -2395,11 +2395,9 @@ tcontrolcode(uchar ascii) {
case 0x9e: /* TODO: PM */ case 0x9e: /* TODO: PM */
case 0x9f: /* TODO: APC */ case 0x9f: /* TODO: APC */
break; break;
default:
return 0;
} }
term.esc &= ~(ESC_STR_END|ESC_STR); term.esc &= ~(ESC_STR_END|ESC_STR);
return 1; return;
} }
void void
@ -2478,7 +2476,10 @@ tputc(char *c, int len) {
* they must not cause conflicts with sequences. * they must not cause conflicts with sequences.
*/ */
if(control) { if(control) {
if (tcontrolcode(ascii)) tcontrolcode(ascii);
/*
* control codes are not shown ever
*/
return; return;
} else if(term.esc & ESC_START) { } else if(term.esc & ESC_START) {
if(term.esc & ESC_CSI) { if(term.esc & ESC_CSI) {
@ -2576,11 +2577,6 @@ tputc(char *c, int len) {
*/ */
return; return;
} }
/*
* Display control codes only if we are in graphic mode
*/
if(control && term.trantbl[term.charset] != CS_GRAPHIC0)
return;
if(sel.ob.x != -1 && BETWEEN(term.c.y, sel.ob.y, sel.oe.y)) if(sel.ob.x != -1 && BETWEEN(term.c.y, sel.ob.y, sel.oe.y))
selclear(NULL); selclear(NULL);