hold the connection and cursor less buggy

This commit is contained in:
y4my4my4m 2023-05-15 01:04:55 +09:00
parent fa14e6c581
commit 4aeb44362b

View file

@ -438,7 +438,12 @@ U0 ANSIParse()
case 'C': case 'C':
// Cursor Right // Cursor Right
// SysLog("Cursor Right %d %d\n", ansi_param_count, ansi_code[0]); // SysLog("Cursor Right %d %d\n", ansi_param_count, ansi_code[0]);
DocPrint(term.doc, "$$CM,%d,0$$", ansi_code[0]); // DocPrint(term.doc, "$$CM,%d,0$$", ansi_code[0]);
// seems to be less prone to bugs?
I64 cr;
for (cr=0; cr<ansi_code[0]; cr++){
DocPrint(term.doc, " ");
}
ptr++; ptr++;
break; break;
case 'D': case 'D':
@ -677,6 +682,7 @@ U0 TerminalTask() {
} }
while (term.sock_ready) { while (term.sock_ready) {
receive_data:
term.buffer_len = TCPSocketReceive(term.sock, term.buffer, BUF_SIZE - 1); term.buffer_len = TCPSocketReceive(term.sock, term.buffer, BUF_SIZE - 1);
if (term.buffer_len > 0) { if (term.buffer_len > 0) {
term.buffer[term.buffer_len] = '\0'; term.buffer[term.buffer_len] = '\0';
@ -684,6 +690,8 @@ U0 TerminalTask() {
ANSIParse; ANSIParse;
} else { } else {
// SysLog("BUF_SIZE: %d\n", BUF_SIZE);
goto receive_data;
// Buffer full or connection closed // Buffer full or connection closed
DocPrint(term.doc, "Error: Connection closed by the remote host.\n"); DocPrint(term.doc, "Error: Connection closed by the remote host.\n");
break; break;