Create a function for DEC test

Almost of the sequences execute their action in a separate function,
which is good because helps to read the full set of sequences
faster.
This commit is contained in:
Roberto E. Vargas Caballero 2014-04-26 09:24:04 +02:00
parent 3764f38fc8
commit 43d74ef362
1 changed files with 15 additions and 9 deletions

24
st.c
View File

@ -394,6 +394,7 @@ 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 bool tcontrolcode(uchar );
static void tdectest(char );
static int32_t tdefcolor(int *, int *, int); static int32_t tdefcolor(int *, int *, int);
static void tselcs(void); static void tselcs(void);
static void tdeftran(char); static void tdeftran(char);
@ -2425,6 +2426,19 @@ tcontrolcode(uchar ascii) {
return 1; return 1;
} }
void
tdectest(char c) {
static char E[UTF_SIZ] = "E";
int x, y;
if(c == '8') { /* DEC screen alignment test. */
for(x = 0; x < term.col; ++x) {
for(y = 0; y < term.row; ++y)
tsetchar(E, &term.c.attr, x, y);
}
}
}
void void
tputc(char *c, int len) { tputc(char *c, int len) {
uchar ascii; uchar ascii;
@ -2504,15 +2518,7 @@ tputc(char *c, int len) {
tdeftran(ascii); tdeftran(ascii);
tselcs(); tselcs();
} else if(term.esc & ESC_TEST) { } else if(term.esc & ESC_TEST) {
if(ascii == '8') { /* DEC screen alignment test. */ tdectest(ascii);
char E[UTF_SIZ] = "E";
int x, y;
for(x = 0; x < term.col; ++x) {
for(y = 0; y < term.row; ++y)
tsetchar(E, &term.c.attr, x, y);
}
}
} else { } else {
switch(ascii) { switch(ascii) {
case '[': case '[':