properly parsing ?25l ?25h code

This commit is contained in:
y4my4my4m 2023-05-03 00:22:42 +09:00
parent 62adc69534
commit e766171a1a

View file

@ -322,30 +322,30 @@ U0 Telnet(U8 *host, U16 port=TELNET_PORT) {
// TODO: Scroll Down // TODO: Scroll Down
ptr++; ptr++;
} else if (*ptr == '?') { } else if (*ptr == '?') {
switch (ansi_code) { ptr++;
case 2: I64 code = 0;
SysLog("code 2");
break; // while (code >= '0' && code <= '9') {
while ('0' <= *ptr <= '9') {
code = code * 10 + (*ptr - '0');
ptr++;
}
// SysLog("?%d\n", code);
switch (code) {
case 25: case 25:
if (*ptr == 'l') // Hide cursor if (*ptr == 'l') SysLog("code 25l");// Hide cursor
SysLog("code 25l"); if (*ptr == 'h') SysLog("code 25h");// Show cursor
break; ptr++; // Move past 'l' or 'h'
if (*ptr == 'h') // Show cursor
SysLog("code 25h");
break;
break; break;
case 1049: case 1049:
if (*ptr == 'l') // Save screen and switch to alternate screen buffer if (*ptr == 'l') SysLog("code 1049l"); // Save screen and switch to alternate screen buffer
SysLog("code 1049l"); if (*ptr == 'h') SysLog("code 1049h"); // Restore screen and switch back to main screen buffer
break; ptr++; // Move past 'l' or 'h'
if (*ptr == 'h') // Restore screen and switch back to main screen buffer
SysLog("code 1049h");
break;
break; break;
default: default:
break; break;
} }
ptr++;
} else if (*ptr == 's') { } else if (*ptr == 's') {
// self.saveCursorPosition(); // self.saveCursorPosition();
ptr++; ptr++;