/* Translate keycode to escape sequence. */ void vt_send(struct term_t *pwin, unsigned int c) { term_t *win = (term_t *)pwin; char s[3]; int f; int len = 1; /* Special key? */ if (c < 256) { /* Translate backspace key? */ if (c == K_ERA) c = win->state.vt_bs; s[0] = c; s[1] = 0; /* CR/LF mode? */ if (c == '\r' && win->state.vt_crlf) { s[1] = '\n'; s[2] = 0; len = 2; } v_termout(win, s, len); if (win->state.vt_nl_delay > 0 && c == '\r') usleep(1000 * win->state.vt_nl_delay); return; } /* Look up code in translation table. */ for (f = 0; vt_keys[f].code; f++) if (vt_keys[f].code == c) break; if (vt_keys[f].code == 0) return; /* Now send appropriate escape code. */ v_termout(win, "\33", 0); if (win->state.vt_type == VT100) { if (win->state.vt_cursor == NORMAL) v_termout(win, vt_keys[f].vt100_st, 0); else v_termout(win, vt_keys[f].vt100_app, 0); } else v_termout(win, vt_keys[f].ansi, 0); }
/* Translate keycode to escape sequence. */ void vt_send(int c) { char s[3]; int f; int len = 1; /* Special key? */ if (c < 256) { /* Translate backspace key? */ if (c == K_ERA) c = vt_bs; s[0] = vt_outmap[c]; /* conversion 04.09.97 / jl */ s[1] = 0; /* CR/LF mode? */ if (c == '\r' && vt_crlf) { s[1] = '\n'; s[2] = 0; len = 2; } v_termout(s, len); if (vt_nl_delay > 0 && c == '\r') usleep(1000 * vt_nl_delay); return; } /* Look up code in translation table. */ for (f = 0; vt_keys[f].code; f++) if (vt_keys[f].code == c) break; if (vt_keys[f].code == 0) return; /* Now send appropriate escape code. */ v_termout("\033", 0); if (vt_type == VT100) { if (vt_cursor == NORMAL) v_termout(vt_keys[f].vt100_st, 0); else v_termout(vt_keys[f].vt100_app, 0); } else v_termout(vt_keys[f].ansi, 0); }
/* * ESC [ ... was seen the last time. Process next character. */ static void state2(term_t *win, int c) { short x, y, attr, f; char temp[32]; /* See if a number follows */ if (c >= '0' && c <= '9') { win->state.escparms[win->state.ptr] = 10*win->state.escparms[win->state.ptr] + c - '0'; return; } /* Separation between numbers ? */ if (c == ';') { if (win->state.ptr < 15) win->state.ptr++; return; } /* ESC [ ? sequence */ if (win->state.escparms[0] == 0 && win->state.ptr == 0 && c == '?') { esc_s = 3; return; } /* Process functions with zero, one, two or more arguments */ switch (c) { case 'A': case 'B': case 'C': case 'D': /* Cursor motion */ if ((f = win->state.escparms[0]) == 0) f = 1; x = win->cursor_x; y = win->cursor_y; x += f * ((c == 'C') - (c == 'D')); if (x < 0) x = 0; if (x >= win->W) x = win->W - 1; if (c == 'B') { /* Down. */ y += f; if (y >= win->H) y = win->H - 1; if (y >= win->state.newy2 + 1) y = win->state.newy2; } if (c == 'A') { /* Up. */ y -= f; if (y < 0) y = 0; if (y <= win->state.newy1 - 1) y = win->state.newy1; } term_wlocate(win, x, y); break; case 'X': /* Character erasing (ECH) */ if ((f = win->state.escparms[0]) == 0) f = 1; term_wclrch(win, f); break; case 'K': /* Line erasing */ switch (win->state.escparms[0]) { case 0: term_wclreol(win); break; case 1: term_wclrbol(win); break; case 2: term_wclrel(win); break; } break; case 'J': /* Screen erasing */ x = win->color; y = win->attr; if (win->state.vt_type == ANSI) { term_wsetattr(win, XA_NORMAL); term_wsetfgcol(win, WHITE); term_wsetbgcol(win, BLACK); } switch (win->state.escparms[0]) { case 0: term_wclreos(win); break; case 1: term_wclrbos(win); break; case 2: term_winclr(win); break; } if (win->state.vt_type == ANSI) { win->color = x; win->attr = y; } break; case 'n': /* Requests / Reports */ switch(win->state.escparms[0]) { case 5: /* Status */ v_termout(win, "\033[0n", 0); break; case 6: /* Cursor Position */ snprintf(temp, 32, "\033[%d;%dR", win->cursor_y + 1, win->cursor_x + 1); v_termout(win, temp, 0); break; } break; case 'c': /* Identify Terminal Type */ if (win->state.vt_type == VT100) { v_termout(win, "\033[?1;2c", 0); break; } v_termout(win, "\033[?c", 0); break; case 'x': /* Request terminal parameters. */ /* Always answers 19200-8N1 no options. */ snprintf(temp, 32, "\033[%c;1;1;120;120;1;0x", win->state.escparms[0] == 1 ? '3' : '2'); v_termout(win, temp, 0); break; case 's': /* Save attributes and cursor position */ win->state.savex = win->cursor_x; win->state.savey = win->cursor_y; win->state.saveattr = win->attr; win->state.savecol = win->color; break; case 'u': /* Restore them */ term_wsetfgcol(win, win->state.savecol); term_wsetattr(win, win->state.saveattr); term_wlocate(win, win->state.savex, win->state.savey); break; case 'h': ansi_mode(win, 1); break; case 'l': ansi_mode(win, 0); break; case 'H': case 'f': /* Set cursor position */ if ((y = win->state.escparms[0]) == 0) y = 1; if ((x = win->state.escparms[1]) == 0) x = 1; if (win->state.vt_om) y += win->state.newy1; term_wlocate(win, x - 1, y - 1); break; case 'g': /* Clear tab stop(s) */ if (win->state.escparms[0] == 0) { x = win->cursor_x; if (x > 159) x = 159; win->state.vt_tabs[x / 32] &= ~(1 << x % 32); } if (win->state.escparms[0] == 3) for(x = 0; x < 5; x++) win->state.vt_tabs[x] = 0; break; case 'm': /* Set attributes */ attr = term_wgetattr((win)); for (f = 0; f <= win->state.ptr; f++) { if (win->state.escparms[f] >= 30 && win->state.escparms[f] <= 37) term_wsetfgcol(win, win->state.escparms[f] - 30); if (win->state.escparms[f] >= 40 && win->state.escparms[f] <= 47) term_wsetbgcol(win, win->state.escparms[f] - 40); switch (win->state.escparms[f]) { case 0: attr = XA_NORMAL; term_wsetfgcol(win, win->state.vt_fg); term_wsetbgcol(win, win->state.vt_bg); break; case 4: attr |= XA_UNDERLINE; break; case 7: attr |= XA_REVERSE; break; case 1: attr |= XA_BOLD; break; case 5: attr |= XA_BLINK; break; case 22: /* Bold off */ attr &= ~XA_BOLD; break; case 24: /* Not underlined */ attr &=~XA_UNDERLINE; break; case 25: /* Not blinking */ attr &= ~XA_BLINK; break; case 27: /* Not reverse */ attr &= ~XA_REVERSE; break; case 39: /* Default fg color */ term_wsetfgcol(win, win->state.vt_fg); break; case 49: /* Default bg color */ term_wsetbgcol(win, win->state.vt_bg); break; } } term_wsetattr(win, attr); break; case 'L': /* Insert lines */ if ((x = win->state.escparms[0]) == 0) x = 1; for (f = 0; f < x; f++) term_winsline(win); break; case 'M': /* Delete lines */ if ((x = win->state.escparms[0]) == 0) x = 1; for (f = 0; f < x; f++) term_wdelline(win); break; case 'P': /* Delete Characters */ if ((x = win->state.escparms[0]) == 0) x = 1; for (f = 0; f < x; f++) term_wdelchar(win); break; case '@': /* Insert Characters */ if ((x = win->state.escparms[0]) == 0) x = 1; for (f = 0; f < x; f++) term_winschar(win, ' ', 0); break; case 'r': /* Set scroll region */ if ((win->state.newy1 = win->state.escparms[0]) == 0) win->state.newy1 = 1; if ((win->state.newy2 = win->state.escparms[1]) == 0) win->state.newy2 = win->H; win->state.newy1-- ; win->state.newy2--; if (win->state.newy1 < 0) win->state.newy1 = 0; if (win->state.newy2 < 0) win->state.newy2 = 0; if (win->state.newy1 >= win->H) win->state.newy1 = win->H - 1; if (win->state.newy2 >= win->H) win->state.newy2 = win->H - 1; if (win->state.newy1 >= win->state.newy2) { win->state.newy1 = 0; win->state.newy2 = win->H - 1; } if(win->state.newy1 > win->state.newy2) term_wsetregion(win, win->state.newy2, win->state.newy1); else term_wsetregion(win, win->state.newy1, win->state.newy2); /// XXX xterm goes to 0,0 ? term_wlocate(win, 0, win->state.newy1); break; case 'i': /* Printing */ case 'y': /* Self test modes */ case 'Z': /* XXX:bt */ break; default: /* IGNORED */ break; } /* Ok, our escape sequence is all done */ esc_s = 0; win->state.ptr = 0; memset(win->state.escparms, 0, sizeof(win->state.escparms)); return; }
/* * ESC was seen the last time. Process the next character. */ static void state1(term_t *win, int c) { short x, y, f; switch(c) { case '[': /* ESC [ */ esc_s = 2; return; case '(': /* ESC ( */ esc_s = 4; return; case ')': /* ESC ) */ esc_s = 5; return; case '#': /* ESC # */ esc_s = 6; return; case 'P': /* ESC P (DCS, Device Control String) */ esc_s = 7; return; case 'D': /* Cursor down */ case 'M': /* Cursor up */ x = win->cursor_x; if (c == 'D') { /* Down. */ y = win->cursor_y + 1; if (y == win->state.newy2 + 1) term_wscroll(win, S_UP); else if (win->cursor_y < win->H) term_wlocate(win, x, y); } if (c == 'M') { /* Up. */ y = win->cursor_y - 1; if (y == win->state.newy1 - 1) term_wscroll(win, S_DOWN); else if (y >= 0) term_wlocate(win, x, y); } break; case 'E': /* CR + NL */ term_wputs(win, (unsigned char *)"\r\n"); break; case '7': /* Save attributes and cursor position */ case 's': win->state.savex = win->cursor_x; win->state.savey = win->cursor_y; win->state.saveattr = win->attr; win->state.savecol = win->color; break; case '8': /* Restore them */ case 'u': win->color = win->state.savecol; /* HACK should use mc_wsetfgcol etc */ term_wsetattr(win, win->state.saveattr); term_wlocate(win, win->state.savex, win->state.savey); break; case '=': /* Keypad into applications mode */ win->state.vt_keypad = APPL; break; case '>': /* Keypad into numeric mode */ win->state.vt_keypad = NORMAL; break; case 'Z': /* Report terminal type */ if (win->state.vt_type == VT100) v_termout(win, "\033[?1;0c", 0); else v_termout(win, "\033[?c", 0); break; case 'c': /* Reset to initial state */ f = XA_NORMAL; term_wsetattr(win, f); win->wrap = (win->state.vt_type != VT100); if (win->state.vt_wrap != -1) win->wrap = win->state.vt_wrap; win->state.vt_crlf = win->state.vt_insert = 0; vt_init((struct term_t *)win, win->state.vt_type, win->state.vt_fg, win->state.vt_bg, win->wrap, 0); term_wlocate(win, 0, 0); break; case 'H': /* Set tab in current position */ x = win->cursor_x; if (x > 159) x = 159; win->state.vt_tabs[x / 32] |= 1 << (x % 32); break; case 'N': /* G2 character set for next character only*/ case 'O': /* G3 " " */ case '<': /* Exit vt52 mode */ default: /* ALL IGNORED */ break; } esc_s = 0; }
void vt_out(int ch) { static unsigned char last_ch; int f; unsigned char c; int go_on = 0; wchar_t wc; if (!ch) return; if (last_ch == '\n' && vt_line_timestamp != TIMESTAMP_LINE_OFF) { struct timeval tmstmp_now; static time_t tmstmp_last; char s[36]; struct tm tmstmp_tm; gettimeofday(&tmstmp_now, NULL); if (( vt_line_timestamp == TIMESTAMP_LINE_PER_SECOND && tmstmp_now.tv_sec != tmstmp_last) || vt_line_timestamp == TIMESTAMP_LINE_SIMPLE || vt_line_timestamp == TIMESTAMP_LINE_EXTENDED) { if ( localtime_r(&tmstmp_now.tv_sec, &tmstmp_tm) && strftime(s, sizeof(s), "[%F %T", &tmstmp_tm)) { output_s(s); switch (vt_line_timestamp) { case TIMESTAMP_LINE_SIMPLE: output_s("] "); break; case TIMESTAMP_LINE_EXTENDED: snprintf(s, sizeof(s), ".%03ld] ", tmstmp_now.tv_usec / 1000); output_s(s); break; case TIMESTAMP_LINE_PER_SECOND: output_s("\r\n"); break; }; } tmstmp_last = tmstmp_now.tv_sec; } } c = (unsigned char)ch; last_ch = c; if (vt_docap == 2) /* Literal. */ fputc(c, capfp); /* Process <31 chars first, even in an escape sequence. */ switch (c) { case 5: /* AnswerBack for vt100's */ if (vt_type != VT100) { go_on = 1; break; } v_termout(P_ANSWERBACK, 0); break; case '\r': /* Carriage return */ mc_wputc(vt_win, c); if (vt_addlf) output_c('\n'); break; case '\t': /* Non - destructive TAB */ /* Find next tab stop. */ for (f = vt_win->curx + 1; f < 160; f++) if (vt_tabs[f / 32] & (1 << f % 32)) break; if (f >= vt_win->xs) f = vt_win->xs - 1; mc_wlocate(vt_win, f, vt_win->cury); if (vt_docap == 1) fputc(c, capfp); break; case 013: /* Old Minix: CTRL-K = up */ mc_wlocate(vt_win, vt_win->curx, vt_win->cury - 1); break; case '\f': /* Form feed: clear screen. */ mc_winclr(vt_win); mc_wlocate(vt_win, 0, 0); break; #if !TRANSLATE case 14: case 15: /* Change character set. Not supported. */ break; #else case 14: vt_charset = 1; break; case 15: vt_charset = 0; break; #endif case 24: case 26: /* Cancel escape sequence. */ esc_s = 0; break; case ESC: /* Begin escape sequence */ esc_s = 1; break; case 128+ESC: /* Begin ESC [ sequence. */ esc_s = 2; break; case '\n': if(vt_addcr) mc_wputc(vt_win, '\r'); output_c(c); break; case '\b': case 7: /* Bell */ output_c(c); break; default: go_on = 1; break; } if (!go_on) return; /* Now see which state we are in. */ switch (esc_s) { case 0: /* Normal character */ if (vt_docap == 1) fputc(P_CONVCAP[0] == 'Y' ? vt_inmap[c] : c, capfp); if (!using_iconv()) { c = vt_inmap[c]; /* conversion 04.09.97 / jl */ #if TRANSLATE if (vt_type == VT100 && vt_trans[vt_charset] && vt_asis == 0) c = vt_trans[vt_charset][c]; #endif } /* FIXME: This is wrong, but making it right would require * removing all the 8-bit mapping features. Assuming the locale * is 8-bit, the character should not be changed by mapping to * wchar and back; if the locale is multibyte, there is no hope * of getting it right anyway. */ if (!using_iconv()) { one_mbtowc (&wc, (char *)&c, 1); /* returns 1 */ if (vt_insert) mc_winschar2(vt_win, wc, 1); else mc_wputc(vt_win, wc); } else { mc_wputc(vt_win, c); } break; case 1: /* ESC seen */ state1(c); break; case 2: /* ESC [ ... seen */ state2(c); break; case 3: state3(c); break; case 4: state4(c); break; case 5: state5(c); break; case 6: state6(c); break; case 7: state7(c); break; } /* Flush output to capture file so that all output is visible there * immediately. Causes a write syscall for every call though. */ if (capfp) fflush(capfp); }
/* * ESC [ ... was seen the last time. Process next character. */ static void state2(int c) { short x, y, attr, f; char temp[32]; /* See if a number follows */ if (c >= '0' && c <= '9') { escparms[ptr] = 10*escparms[ptr] + c - '0'; return; } /* Separation between numbers ? */ if (c == ';') { if (ptr < 15) ptr++; return; } /* ESC [ ? sequence */ if (escparms[0] == 0 && ptr == 0 && c == '?') { esc_s = 3; return; } /* Process functions with zero, one, two or more arguments */ switch (c) { case 'A': case 'B': case 'C': case 'D': /* Cursor motion */ if ((f = escparms[0]) == 0) f = 1; x = vt_win->curx; y = vt_win->cury; x += f * ((c == 'C') - (c == 'D')); if (x < 0) x = 0; if (x >= vt_win->xs) x = vt_win->xs - 1; if (c == 'B') { /* Down. */ y += f; if (y >= vt_win->ys) y = vt_win->ys - 1; if (y >= newy2 + 1) y = newy2; } if (c == 'A') { /* Up. */ y -= f; if (y < 0) y = 0; if (y <= newy1 - 1) y = newy1; } mc_wlocate(vt_win, x, y); break; case 'X': /* Character erasing (ECH) */ if ((f = escparms[0]) == 0) f = 1; mc_wclrch(vt_win, f); break; case 'K': /* Line erasing */ switch (escparms[0]) { case 0: mc_wclreol(vt_win); break; case 1: mc_wclrbol(vt_win); break; case 2: mc_wclrel(vt_win); break; } break; case 'J': /* Screen erasing */ x = vt_win->color; y = vt_win->attr; if (vt_type == ANSI) { mc_wsetattr(vt_win, XA_NORMAL); mc_wsetfgcol(vt_win, WHITE); mc_wsetbgcol(vt_win, BLACK); } switch (escparms[0]) { case 0: mc_wclreos(vt_win); break; case 1: mc_wclrbos(vt_win); break; case 2: mc_winclr(vt_win); break; } if (vt_type == ANSI) { vt_win->color = x; vt_win->attr = y; } break; case 'n': /* Requests / Reports */ switch(escparms[0]) { case 5: /* Status */ v_termout("\033[0n", 0); break; case 6: /* Cursor Position */ sprintf(temp, "\033[%d;%dR", vt_win->cury + 1, vt_win->curx + 1); v_termout(temp, 0); break; } break; case 'c': /* Identify Terminal Type */ if (vt_type == VT100) { v_termout("\033[?1;2c", 0); break; } v_termout("\033[?c", 0); break; case 'x': /* Request terminal parameters. */ /* Always answers 19200-8N1 no options. */ sprintf(temp, "\033[%c;1;1;120;120;1;0x", escparms[0] == 1 ? '3' : '2'); v_termout(temp, 0); break; case 's': /* Save attributes and cursor position */ savex = vt_win->curx; savey = vt_win->cury; saveattr = vt_win->attr; savecol = vt_win->color; #if TRANSLATE savecharset = vt_charset; savetrans[0] = vt_trans[0]; savetrans[1] = vt_trans[1]; #endif break; case 'u': /* Restore them */ #if TRANSLATE vt_charset = savecharset; vt_trans[0] = savetrans[0]; vt_trans[1] = savetrans[1]; #endif vt_win->color = savecol; /* HACK should use mc_wsetfgcol etc */ mc_wsetattr(vt_win, saveattr); mc_wlocate(vt_win, savex, savey); break; case 'h': ansi_mode(1); break; case 'l': ansi_mode(0); break; case 'H': case 'f': /* Set cursor position */ if ((y = escparms[0]) == 0) y = 1; if ((x = escparms[1]) == 0) x = 1; if (vt_om) y += newy1; mc_wlocate(vt_win, x - 1, y - 1); break; case 'g': /* Clear tab stop(s) */ if (escparms[0] == 0) { x = vt_win->curx; if (x > 159) x = 159; vt_tabs[x / 32] &= ~(1 << x % 32); } if (escparms[0] == 3) for(x = 0; x < 5; x++) vt_tabs[x] = 0; break; case 'm': /* Set attributes */ attr = mc_wgetattr((vt_win)); for (f = 0; f <= ptr; f++) { if (escparms[f] >= 30 && escparms[f] <= 37) mc_wsetfgcol(vt_win, escparms[f] - 30); if (escparms[f] >= 40 && escparms[f] <= 47) mc_wsetbgcol(vt_win, escparms[f] - 40); switch (escparms[f]) { case 0: attr = XA_NORMAL; mc_wsetfgcol(vt_win, vt_fg); mc_wsetbgcol(vt_win, vt_bg); break; case 1: attr |= XA_BOLD; break; case 4: attr |= XA_UNDERLINE; break; case 5: attr |= XA_BLINK; break; case 7: attr |= XA_REVERSE; break; case 22: /* Bold off */ attr &= ~XA_BOLD; break; case 24: /* Not underlined */ attr &=~XA_UNDERLINE; break; case 25: /* Not blinking */ attr &= ~XA_BLINK; break; case 27: /* Not reverse */ attr &= ~XA_REVERSE; break; case 39: /* Default fg color */ mc_wsetfgcol(vt_win, vt_fg); break; case 49: /* Default bg color */ mc_wsetbgcol(vt_win, vt_bg); break; } } mc_wsetattr(vt_win, attr); break; case 'L': /* Insert lines */ if ((x = escparms[0]) == 0) x = 1; for (f = 0; f < x; f++) mc_winsline(vt_win); break; case 'M': /* Delete lines */ if ((x = escparms[0]) == 0) x = 1; for (f = 0; f < x; f++) mc_wdelline(vt_win); break; case 'P': /* Delete Characters */ if ((x = escparms[0]) == 0) x = 1; for (f = 0; f < x; f++) mc_wdelchar(vt_win); break; case '@': /* Insert Characters */ if ((x = escparms[0]) == 0) x = 1; for (f = 0; f < x; f++) mc_winschar(vt_win); break; case 'r': /* Set scroll region */ if ((newy1 = escparms[0]) == 0) newy1 = 1; if ((newy2 = escparms[1]) == 0) newy2 = vt_win->ys; newy1-- ; newy2--; if (newy1 < 0) newy1 = 0; if (newy2 < 0) newy2 = 0; if (newy1 >= vt_win->ys) newy1 = vt_win->ys - 1; if (newy2 >= vt_win->ys) newy2 = vt_win->ys - 1; if (newy1 >= newy2) { newy1 = 0; newy2 = vt_win->ys - 1; } mc_wsetregion(vt_win, newy1, newy2); mc_wlocate(vt_win, 0, newy1); break; case 'i': /* Printing */ case 'y': /* Self test modes */ default: /* IGNORED */ break; } /* Ok, our escape sequence is all done */ esc_s = 0; ptr = 0; memset(escparms, 0, sizeof(escparms)); return; }
/* * ESC was seen the last time. Process the next character. */ static void state1(int c) { short x, y, f; switch(c) { case '[': /* ESC [ */ esc_s = 2; return; case '(': /* ESC ( */ esc_s = 4; return; case ')': /* ESC ) */ esc_s = 5; return; case '#': /* ESC # */ esc_s = 6; return; case 'P': /* ESC P (DCS, Device Control String) */ esc_s = 7; return; case 'D': /* Cursor down */ case 'M': /* Cursor up */ x = vt_win->curx; if (c == 'D') { /* Down. */ y = vt_win->cury + 1; if (y == newy2 + 1) mc_wscroll(vt_win, S_UP); else if (vt_win->cury < vt_win->ys) mc_wlocate(vt_win, x, y); } if (c == 'M') { /* Up. */ y = vt_win->cury - 1; if (y == newy1 - 1) mc_wscroll(vt_win, S_DOWN); else if (y >= 0) mc_wlocate(vt_win, x, y); } break; case 'E': /* CR + NL */ mc_wputs(vt_win, "\r\n"); break; case '7': /* Save attributes and cursor position */ case 's': savex = vt_win->curx; savey = vt_win->cury; saveattr = vt_win->attr; savecol = vt_win->color; #if TRANSLATE savecharset = vt_charset; savetrans[0] = vt_trans[0]; savetrans[1] = vt_trans[1]; #endif break; case '8': /* Restore them */ case 'u': #if TRANSLATE vt_charset = savecharset; vt_trans[0] = savetrans[0]; vt_trans[1] = savetrans[1]; #endif vt_win->color = savecol; /* HACK should use mc_wsetfgcol etc */ mc_wsetattr(vt_win, saveattr); mc_wlocate(vt_win, savex, savey); break; case '=': /* Keypad into applications mode */ vt_keypad = APPL; if (vt_keyb) (*vt_keyb)(vt_keypad, vt_cursor); break; case '>': /* Keypad into numeric mode */ vt_keypad = NORMAL; if (vt_keyb) (*vt_keyb)(vt_keypad, vt_cursor); break; case 'Z': /* Report terminal type */ if (vt_type == VT100) v_termout("\033[?1;0c", 0); else v_termout("\033[?c", 0); break; case 'c': /* Reset to initial state */ f = XA_NORMAL; mc_wsetattr(vt_win, f); vt_win->wrap = (vt_type != VT100); if (vt_wrap != -1) vt_win->wrap = vt_wrap; vt_crlf = vt_insert = 0; vt_init(vt_type, vt_fg, vt_bg, vt_win->wrap, 0, 0); mc_wlocate(vt_win, 0, 0); break; case 'H': /* Set tab in current position */ x = vt_win->curx; if (x > 159) x = 159; vt_tabs[x / 32] |= 1 << (x % 32); break; case 'N': /* G2 character set for next character only*/ case 'O': /* G3 " " */ case '<': /* Exit vt52 mode */ default: /* ALL IGNORED */ break; } esc_s = 0; }