This commit is contained in:
y4my4my4m 2023-05-18 03:10:22 +09:00
parent 04d21a878a
commit 66ec1f6320

View file

@ -164,9 +164,8 @@ U0 ANSIParse()
// } // }
// Telnet negotiation sequence // Telnet negotiation sequence
if (*ptr == NEGOTIATE) { if (*ptr == NEGOTIATE) {
// TODO: verify this is working, somehow /*telnet negotiation seems proper...however i don't really see any BBS systems relying on this too much...
// i see it being sent out as multiple short burst instead of one long answer for instance, the screen size tends to be reported using the Curser Report and not Telnet's NAWS */
// anyway, i'm not sure how to verify if it's working or not but the code seems OK
if (term.sock_ready) TelnetNegotiate(term.sock, ptr); if (term.sock_ready) TelnetNegotiate(term.sock, ptr);
ptr += 3; ptr += 3;
} }
@ -216,11 +215,9 @@ U0 ANSIParse()
} }
else if (ansi_code[0] == 6) { else if (ansi_code[0] == 6) {
// Respond with cursor position // Respond with cursor position
// U8 response[7] = "\x1B[%d;%dR", term.window_width, term.window_height;
SysLog("reported cursor position\n"); SysLog("reported cursor position\n");
// TODO: hardcoded the position 80x24 // TODO: position 24rows x 80cols is hardcoded, should actually report the real cursor position
// U8 response[9] = "\x1B[80;24R"; // U8 cursorResponse[9] = "\x1B[24;80R";
// if (term.sock_ready) TCPSocketSend(term.sock, response, 9);
U8 cursorResponse[9]; U8 cursorResponse[9];
cursorResponse[0] = ANSI_ESC; cursorResponse[0] = ANSI_ESC;
cursorResponse[1] = '['; // Start of CSI cursorResponse[1] = '['; // Start of CSI
@ -235,7 +232,7 @@ U0 ANSIParse()
} }
else if (ansi_code[0] == 255) { else if (ansi_code[0] == 255) {
// https://github.com/NuSkooler/enigma-bbs/blob/97cd0c3063b0c9f93a0fa4a44a85318ca81aef43/core/ansi_term.js#L140 // https://github.com/NuSkooler/enigma-bbs/blob/97cd0c3063b0c9f93a0fa4a44a85318ca81aef43/core/ansi_term.js#L140
SysLog("reported screensize?\n"); SysLog("TODO: reported screensize?\n");
// SendWindowSize(term.sock, 80, 25); // SendWindowSize(term.sock, 80, 25);
} }
ptr++; ptr++;
@ -257,8 +254,8 @@ U0 ANSIParse()
ptr++; ptr++;
break; break;
case 'm': case 'm':
// this is where colors are being set
// TODO: what happens in this case??? --> [0;1;34;44m // TODO: what happens in this case??? --> [0;1;34;44m
I64 m; I64 m;
Bool isBright = FALSE; Bool isBright = FALSE;
for (m = 0; m <= ansi_param_count; m++) { for (m = 0; m <= ansi_param_count; m++) {
@ -719,8 +716,10 @@ receive_data:
//SysLog("BUF_SIZE: %d\n", BUF_SIZE); //SysLog("BUF_SIZE: %d\n", BUF_SIZE);
if (!term.sock_ready || force_disconnect) if (!term.sock_ready || force_disconnect)
DocPrint(term.doc, "Error: Connection closed by the remote host.\n"); DocPrint(term.doc, "Error: Connection closed by the remote host.\n");
else else {
SysLog("goto received_data\n");
goto receive_data; goto receive_data;
}
break; break;
} }
} }
@ -885,7 +884,7 @@ init_connection:
} }
case CH_BACKSPACE: case CH_BACKSPACE:
if (term.sock_ready) TCPSocketSendString(term.sock, "\x7F"); if (term.sock_ready) TCPSocketSendString(term.sock, "\x08\x7F");
break; break;
case CH_ESC: case CH_ESC:
if (term.sock_ready) TCPSocketSendString(term.sock, "\x1B"); if (term.sock_ready) TCPSocketSendString(term.sock, "\x1B");
@ -904,7 +903,6 @@ init_connection:
else else
force_disconnect = TRUE; force_disconnect = TRUE;
break; break;
break;
// send buffer on enter // send buffer on enter
case '\n': case '\n':
if (term.sock_ready) TCPSocketSendString(term.sock, "\r\n"); if (term.sock_ready) TCPSocketSendString(term.sock, "\r\n");