From e766171a1ae83e8d3199c9ccf77acffbc8054fcb Mon Sep 17 00:00:00 2001 From: y4my4my4m <8145020+y4my4my4m@users.noreply.github.com> Date: Wed, 3 May 2023 00:22:42 +0900 Subject: [PATCH] properly parsing ?25l ?25h code --- src/Home/Telnet/Telnet.ZC | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/Home/Telnet/Telnet.ZC b/src/Home/Telnet/Telnet.ZC index e95de9f9..2dff3e89 100755 --- a/src/Home/Telnet/Telnet.ZC +++ b/src/Home/Telnet/Telnet.ZC @@ -322,30 +322,30 @@ U0 Telnet(U8 *host, U16 port=TELNET_PORT) { // TODO: Scroll Down ptr++; } else if (*ptr == '?') { - switch (ansi_code) { - case 2: - SysLog("code 2"); - break; + ptr++; + I64 code = 0; + + // while (code >= '0' && code <= '9') { + while ('0' <= *ptr <= '9') { + code = code * 10 + (*ptr - '0'); + ptr++; + } + + // SysLog("?%d\n", code); + switch (code) { case 25: - if (*ptr == 'l') // Hide cursor - SysLog("code 25l"); - break; - if (*ptr == 'h') // Show cursor - SysLog("code 25h"); - break; + if (*ptr == 'l') SysLog("code 25l");// Hide cursor + if (*ptr == 'h') SysLog("code 25h");// Show cursor + ptr++; // Move past 'l' or 'h' break; case 1049: - if (*ptr == 'l') // Save screen and switch to alternate screen buffer - SysLog("code 1049l"); - break; - if (*ptr == 'h') // Restore screen and switch back to main screen buffer - SysLog("code 1049h"); - break; + if (*ptr == 'l') SysLog("code 1049l"); // Save screen and switch to alternate screen buffer + if (*ptr == 'h') SysLog("code 1049h"); // Restore screen and switch back to main screen buffer + ptr++; // Move past 'l' or 'h' break; default: break; } - ptr++; } else if (*ptr == 's') { // self.saveCursorPosition(); ptr++;