📄 vt320.java
字号:
case 'I': // RI insertLine(R, 1, SCROLL_DOWN); break; case 'E': /* NEL */ if (R == bm || R == rows - 1) insertLine(R, 1, SCROLL_UP); else R++; C = 0; if (debug > 1) System.out.println("ESC E (at " + R + ")"); break; case 'D': /* IND */ if (R == bm || R == rows - 1) insertLine(R, 1, SCROLL_UP); else R++; if (debug > 1) System.out.println("ESC D (at " + R + " )"); break; case 'J': /* erase to end of screen */ if (R < rows - 1) deleteArea(0, R + 1, columns, rows - R - 1, attributes); if (C < columns - 1) deleteArea(C, R, columns - C, 1, attributes); break; case 'K': if (C < columns - 1) deleteArea(C, R, columns - C, 1, attributes); break; case 'M': // RI System.out.println("ESC M : R is "+R+", tm is "+tm+", bm is "+bm); if (R > bm) // outside scrolling region break; if (R > tm) { // just go up 1 line. R--; } else { // scroll down insertLine(R, 1, SCROLL_DOWN); } /* else do nothing ; */ if (debug > 2) System.out.println("ESC M "); break; case 'H': if (debug > 1) System.out.println("ESC H at " + C); /* right border probably ...*/ if (C >= columns) C = columns - 1; Tabs[C] = 1; break; case 'N': // SS2 onegl = 2; break; case 'O': // SS3 onegl = 3; break; case '=': /*application keypad*/ if (debug > 0) System.out.println("ESC ="); keypadmode = true; break; case '<': /* vt52 mode off */ vt52mode = false; break; case '>': /*normal keypad*/ if (debug > 0) System.out.println("ESC >"); keypadmode = false; break; case '7': /*save cursor, attributes, margins */ Sc = C; Sr = R; Sgl = gl; Sgr = gr; Sa = attributes; Sgx = new char[4]; for (int i = 0; i < 4; i++) Sgx[i] = gx[i]; Stm = getTopMargin(); Sbm = getBottomMargin(); if (debug > 1) System.out.println("ESC 7"); break; case '8': /*restore cursor, attributes, margins */ C = Sc; R = Sr; gl = Sgl; gr = Sgr; for (int i = 0; i < 4; i++) gx[i] = Sgx[i]; setTopMargin(Stm); setBottomMargin(Sbm); attributes = Sa; if (debug > 1) System.out.println("ESC 8"); break; case '(': /* Designate G0 Character set (ISO 2022) */ term_state = TSTATE_SETG0; usedcharsets = true; break; case ')': /* Designate G1 character set (ISO 2022) */ term_state = TSTATE_SETG1; usedcharsets = true; break; case '*': /* Designate G2 Character set (ISO 2022) */ term_state = TSTATE_SETG2; usedcharsets = true; break; case '+': /* Designate G3 Character set (ISO 2022) */ term_state = TSTATE_SETG3; usedcharsets = true; break; case '~': /* Locking Shift 1, right */ gr = 1; usedcharsets = true; break; case 'n': /* Locking Shift 2 */ gl = 2; usedcharsets = true; break; case '}': /* Locking Shift 2, right */ gr = 2; usedcharsets = true; break; case 'o': /* Locking Shift 3 */ gl = 3; usedcharsets = true; break; case '|': /* Locking Shift 3, right */ gr = 3; usedcharsets = true; break; case 'Y': /* vt52 cursor address mode , next chars are x,y */ term_state = TSTATE_VT52Y; break; default: System.out.println("ESC unknown letter: " + c + " (" + ((int) c) + ")"); break; } break; case TSTATE_VT52X: C = c - 37; term_state = TSTATE_VT52Y; break; case TSTATE_VT52Y: R = c - 37; term_state = TSTATE_DATA; break; case TSTATE_SETG0: if (c != '0' && c != 'A' && c != 'B' && c != '<') System.out.println("ESC ( " + c + ": G0 char set? (" + ((int) c) + ")"); else { if (debug > 2) System.out.println("ESC ( : G0 char set (" + c + " " + ((int) c) + ")"); gx[0] = c; } term_state = TSTATE_DATA; break; case TSTATE_SETG1: if (c != '0' && c != 'A' && c != 'B' && c != '<') { System.out.println("ESC ) " + c + " (" + ((int) c) + ") :G1 char set?"); } else { if (debug > 2) System.out.println("ESC ) :G1 char set (" + c + " " + ((int) c) + ")"); gx[1] = c; } term_state = TSTATE_DATA; break; case TSTATE_SETG2: if (c != '0' && c != 'A' && c != 'B' && c != '<') System.out.println("ESC*:G2 char set? (" + ((int) c) + ")"); else { if (debug > 2) System.out.println("ESC*:G2 char set (" + c + " " + ((int) c) + ")"); gx[2] = c; } term_state = TSTATE_DATA; break; case TSTATE_SETG3: if (c != '0' && c != 'A' && c != 'B' && c != '<') System.out.println("ESC+:G3 char set? (" + ((int) c) + ")"); else { if (debug > 2) System.out.println("ESC+:G3 char set (" + c + " " + ((int) c) + ")"); gx[3] = c; } term_state = TSTATE_DATA; break; case TSTATE_ESCSQUARE: switch (c) { case '8': for (int i = 0; i < columns; i++) for (int j = 0; j < rows; j++) putChar(i, j, 'E', 0); break; default: System.out.println("ESC # " + c + " not supported."); break; } term_state = TSTATE_DATA; break; case TSTATE_DCS: if (c == '\\' && dcs.charAt(dcs.length() - 1) == ESC) { handle_dcs(dcs); term_state = TSTATE_DATA; break; } dcs = dcs + c; break; case TSTATE_DCEQ: term_state = TSTATE_DATA; switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': DCEvars[DCEvar] = DCEvars[DCEvar] * 10 + ((int) c) - 48; term_state = TSTATE_DCEQ; break; case ';': DCEvar++; DCEvars[DCEvar] = 0; term_state = TSTATE_DCEQ; break; case 's': // XTERM_SAVE missing! if (true || debug > 1) System.out.println("ESC [ ? " + DCEvars[0] + " s unimplemented!"); break; case 'r': // XTERM_RESTORE if (true || debug > 1) System.out.println("ESC [ ? " + DCEvars[0] + " r"); /* DEC Mode reset */ for (int i = 0; i <= DCEvar; i++) { switch (DCEvars[i]) { case 3: /* 80 columns*/ setScreenSize(80, getRows()); break; case 4: /* scrolling mode, smooth */ break; case 5: /* light background */ break; case 6: /* DECOM (Origin Mode) move inside margins. */ moveoutsidemargins = true; break; case 7: /* DECAWM: Autowrap Mode */ wraparound = false; break; case 12:/* local echo off */ break; case 9: /* X10 mouse */ case 1000: /* xterm style mouse report on */ case 1001: case 1002: case 1003: mouserpt = DCEvars[i]; break; default: System.out.println("ESC [ ? " + DCEvars[0] + " r, unimplemented!"); } } break; case 'h': // DECSET if (debug > 0) System.out.println("ESC [ ? " + DCEvars[0] + " h"); /* DEC Mode set */ for (int i = 0; i <= DCEvar; i++) { switch (DCEvars[i]) { case 1: /* Application cursor keys */ KeyUp[0] = "\u001bOA"; KeyDown[0] = "\u001bOB"; KeyRight[0] = "\u001bOC"; KeyLeft[0] = "\u001bOD"; break; case 2: /* DECANM */ vt52mode = false; break; case 3: /* 132 columns*/ setScreenSize(132, getRows()); break; case 6: /* DECOM: move inside margins. */ moveoutsidemargins = false; break; case 7: /* DECAWM: Autowrap Mode */ wraparound = true; break; case 25: /* turn cursor on */ showCursor(true); break; case 9: /* X10 mouse */ case 1000: /* xterm style mouse report on */ case 1001: case 1002: case 1003: mouserpt = DCEvars[i]; break; /* unimplemented stuff, fall through */ /* 4 - scrolling mode, smooth */ /* 5 - light background */ /* 12 - local echo off */ /* 18 - DECPFF - Printer Form Feed Mode -> On */ /* 19 - DECPEX - Printer Extent Mode -> Screen */ default: System.out.println("ESC [ ? " + DCEvars[0] + " h, unsupported."); break; } } break; case 'i': // DEC Printer Control, autoprint, echo screenchars to printer // This is different to CSI i! // Also: "Autoprint prints a final display line only when the // cursor is moved off the line by an autowrap or LF, FF, or // VT (otherwise do not print the line)." switch (DCEvars[0]) { case 1: if (debug > 1) System.out.println("CSI ? 1 i : Print line containing cursor"); break; case 4: if (debug > 1) System.out.println("CSI ? 4 i : Start passthrough printing"); break; case 5: if (debug > 1) System.out.println("CSI ? 4 i : Stop passthrough printing"); break; } break; case 'l': //DECRST /* DEC Mode reset */ if (debug > 0) System.out.println("ESC [ ? " + DCEvars[0] + " l"); for (int i = 0; i <= DCEvar; i++) { switch (DCEvars[i]) { case 1: /* Application cursor keys */ KeyUp[0] = "\u001b[A"; KeyDown[0] = "\u001b[B"; KeyRight[0] = "\u001b[C"; KeyLeft[0] = "\u001b[D"; break; case 2: /* DECANM */ vt52mode = true; break; case 3: /* 80 columns*/ setScreenSize(80, getRows()); break; case 6: /* DECOM: move outside margins. */ moveoutsidemargins = true; break; case 7: /* DECAWM: Autowrap Mode OFF */ wraparound = false; break; case 25: /* turn cursor off */ showCursor(false); break; /* Unimplemented stuff: */ /* 4 - scrolling mode, jump */ /* 5 - dark background */ /* 7 - DECAWM - no wrap around mode */ /* 12 - local echo on */ /* 18 - DECPFF - Printer Form Feed Mode -> Off*/ /* 19 - DECPEX - Printer Extent Mode -> Scrolling Region */ case 9: /* X10 mouse */ case 1000: /* xterm style mouse report OFF */ case 1001: case 1002: case 1003: mouserpt = 0; break; default: System.out.println("ESC [ ? " + DCEvars[0] + " l, unsupported."); break; } } break; case 'n': if (debug > 0) System.out.println("ESC [ ? " + DCEvars[0] + " n"); switch (DCEvars[0]) { case 15: /* printer? no printer. */ write(((char) ESC) + "[?13n", false); System.out.println("ESC[5n"); break; default: System.out.println("ESC [ ? " + DCEvars[0] + " n, unsupported."); break; } break; default: System.out.println("ESC [ ? " + DCEvars[0] + " " + c + ", unsupported."); break; } break; case TSTATE_CSI_EX: term_state = TSTATE_DATA; switch (c) { case ESC: term_state = TSTATE_ESC; break; default: System.out.println("Unknown character ESC[! character is " + (int)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -