mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-25 23:10:32 +00:00
telnet fix and telnet32 bgcolor
This commit is contained in:
parent
77f02374b4
commit
df0b3bef94
2 changed files with 36 additions and 26 deletions
|
@ -39,6 +39,7 @@ I64 TelnetOpen(U8 *host, U16 port) {
|
||||||
// sock(CTCPSocket *)->timeout = TCP_TIMEOUT;
|
// sock(CTCPSocket *)->timeout = TCP_TIMEOUT;
|
||||||
return sock;
|
return sock;
|
||||||
}
|
}
|
||||||
|
|
||||||
U0 HandleControlCodes(U8 ch) {
|
U0 HandleControlCodes(U8 ch) {
|
||||||
if (ch < 32) { // ASCII code below 32 (control character)
|
if (ch < 32) { // ASCII code below 32 (control character)
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
|
@ -48,22 +49,24 @@ U0 HandleControlCodes(U8 ch) {
|
||||||
Beep;
|
Beep;
|
||||||
break;
|
break;
|
||||||
case 8: // BS (Backspace)
|
case 8: // BS (Backspace)
|
||||||
term.cursor_x--;
|
// "%c%c%c", 8, ' ', 8; // Move cursor back, erase character, move cursor back again
|
||||||
|
"$$CM,-8,0$$";
|
||||||
break;
|
break;
|
||||||
case 9: // HT (Horizontal Tab)
|
case 9: // HT (Horizontal Tab)
|
||||||
term.cursor_x += 8;
|
// " "; // 8 spaces
|
||||||
|
"$$CM,8,0$$";
|
||||||
break;
|
break;
|
||||||
case 10: // LF (Line Feed)
|
case 10: // LF (Line Feed)
|
||||||
term.cursor_y++;
|
"\n";
|
||||||
break;
|
break;
|
||||||
case 11: // VT (Vertical Tab)
|
case 11: // VT (Vertical Tab)
|
||||||
SysLog("Vertical Tab\n");
|
SysLog("Vertical Tab\n");
|
||||||
break;
|
break;
|
||||||
case 12: // FF (Form Feed)
|
case 12: // FF (Form Feed)
|
||||||
DocClear(term.doc);
|
DocClear;
|
||||||
break;
|
break;
|
||||||
case 13: // CR (Carriage Return)
|
case 13: // CR (Carriage Return)
|
||||||
term.cursor_y++;
|
"\r";
|
||||||
break;
|
break;
|
||||||
case 14: // SO (Shift Out) - Switch to an alternate character set
|
case 14: // SO (Shift Out) - Switch to an alternate character set
|
||||||
case 15: // SI (Shift In) - Switch back to the default character set
|
case 15: // SI (Shift In) - Switch back to the default character set
|
||||||
|
@ -100,6 +103,7 @@ U0 HandleControlCodes(U8 ch) {
|
||||||
SysLog("Unit Separator\n");
|
SysLog("Unit Separator\n");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
// some ch make Zeal crash or behave weird because they're commands?
|
||||||
// SysLog("CC %c happened\n", ch);
|
// SysLog("CC %c happened\n", ch);
|
||||||
SysLog("CC happened\n");
|
SysLog("CC happened\n");
|
||||||
break;
|
break;
|
||||||
|
@ -110,7 +114,7 @@ U0 HandleControlCodes(U8 ch) {
|
||||||
SysLog("case 127");
|
SysLog("case 127");
|
||||||
}
|
}
|
||||||
if (ch == 0x24) {
|
if (ch == 0x24) {
|
||||||
// ch = "//$$$$";
|
ch = "//$$$$";
|
||||||
}
|
}
|
||||||
if (ch >= 32 && ch < 256) // ZealOS's ASCII is up to 255
|
if (ch >= 32 && ch < 256) // ZealOS's ASCII is up to 255
|
||||||
{
|
{
|
||||||
|
@ -121,6 +125,7 @@ U0 HandleControlCodes(U8 ch) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
U0 InputTask(U0 *args) {
|
U0 InputTask(U0 *args) {
|
||||||
I64 sock = *args;
|
I64 sock = *args;
|
||||||
I64 sc;
|
I64 sc;
|
||||||
|
|
|
@ -27,6 +27,7 @@ Bool redraw_needed = FALSE;
|
||||||
class ScreenCell {
|
class ScreenCell {
|
||||||
U8 ch;
|
U8 ch;
|
||||||
I64 color;
|
I64 color;
|
||||||
|
I64 bgcolor;
|
||||||
}
|
}
|
||||||
class Terminal {
|
class Terminal {
|
||||||
I64 sock;
|
I64 sock;
|
||||||
|
@ -40,6 +41,7 @@ class Terminal {
|
||||||
ScreenCell screen[25][80];
|
ScreenCell screen[25][80];
|
||||||
|
|
||||||
I64 current_color;
|
I64 current_color;
|
||||||
|
I64 current_bgcolor;
|
||||||
I64 cursor_x;
|
I64 cursor_x;
|
||||||
I64 cursor_y;
|
I64 cursor_y;
|
||||||
|
|
||||||
|
@ -154,6 +156,7 @@ U0 HandleControlCodes(U8 ch) {
|
||||||
{
|
{
|
||||||
term.screen[term.cursor_y][term.cursor_x].ch = ch;
|
term.screen[term.cursor_y][term.cursor_x].ch = ch;
|
||||||
term.screen[term.cursor_y][term.cursor_x].color = term.current_color;
|
term.screen[term.cursor_y][term.cursor_x].color = term.current_color;
|
||||||
|
term.screen[term.cursor_y][term.cursor_x].bgcolor = term.current_bgcolor;
|
||||||
term.cursor_x++;
|
term.cursor_x++;
|
||||||
if (term.cursor_x >= term.window_width) {
|
if (term.cursor_x >= term.window_width) {
|
||||||
term.cursor_x = 0;
|
term.cursor_x = 0;
|
||||||
|
@ -184,6 +187,7 @@ U0 TerminalDrawIt(CTask *task, CDC *dc)
|
||||||
|
|
||||||
// Set the color
|
// Set the color
|
||||||
dc->color = term.screen[row][col].color;
|
dc->color = term.screen[row][col].color;
|
||||||
|
dc->bkcolor = term.screen[row][col].bgcolor;
|
||||||
// term.dc->color = WHITE;
|
// term.dc->color = WHITE;
|
||||||
|
|
||||||
// Draw the character
|
// Draw the character
|
||||||
|
@ -313,6 +317,7 @@ U0 TerminalTask() {
|
||||||
if (ansi_code[m] <= 10) {
|
if (ansi_code[m] <= 10) {
|
||||||
switch (ansi_code[m]) {
|
switch (ansi_code[m]) {
|
||||||
case 0:
|
case 0:
|
||||||
|
term.current_bgcolor = BLACK; // should be BG FG for full reset
|
||||||
term.current_color = WHITE; // should be BG FG for full reset
|
term.current_color = WHITE; // should be BG FG for full reset
|
||||||
isBright = FALSE;
|
isBright = FALSE;
|
||||||
break; // reset
|
break; // reset
|
||||||
|
@ -404,32 +409,32 @@ U0 TerminalTask() {
|
||||||
if(!isBright){
|
if(!isBright){
|
||||||
switch (ansi_code[m]) {
|
switch (ansi_code[m]) {
|
||||||
case 40:
|
case 40:
|
||||||
term.current_color = BLACK;
|
term.current_bgcolor = BLACK;
|
||||||
break;
|
break;
|
||||||
case 41:
|
case 41:
|
||||||
term.current_color = RED;
|
term.current_bgcolor = RED;
|
||||||
break;
|
break;
|
||||||
case 42:
|
case 42:
|
||||||
term.current_color = GREEN;
|
term.current_bgcolor = GREEN;
|
||||||
break;
|
break;
|
||||||
case 43:
|
case 43:
|
||||||
term.current_color = YELLOW;
|
term.current_bgcolor = YELLOW;
|
||||||
break;
|
break;
|
||||||
case 44:
|
case 44:
|
||||||
term.current_color = BLUE;
|
term.current_bgcolor = BLUE;
|
||||||
break;
|
break;
|
||||||
case 45:
|
case 45:
|
||||||
term.current_color = PURPLE;
|
term.current_bgcolor = PURPLE;
|
||||||
break;
|
break;
|
||||||
case 46:
|
case 46:
|
||||||
term.current_color = CYAN;
|
term.current_bgcolor = CYAN;
|
||||||
break;
|
break;
|
||||||
case 47:
|
case 47:
|
||||||
term.current_color = WHITE;
|
term.current_bgcolor = WHITE;
|
||||||
break;
|
break;
|
||||||
case 49:
|
case 49:
|
||||||
// reset
|
// reset
|
||||||
term.current_color = BLACK;
|
term.current_bgcolor = BLACK;
|
||||||
break;
|
break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
@ -438,39 +443,39 @@ U0 TerminalTask() {
|
||||||
switch (ansi_code[m]) {
|
switch (ansi_code[m]) {
|
||||||
case 100:
|
case 100:
|
||||||
case 40:
|
case 40:
|
||||||
term.current_color = DKGRAY;
|
term.current_bgcolor = DKGRAY;
|
||||||
break;
|
break;
|
||||||
case 101:
|
case 101:
|
||||||
case 41:
|
case 41:
|
||||||
term.current_color = LTRED;
|
term.current_bgcolor = LTRED;
|
||||||
break;
|
break;
|
||||||
case 102:
|
case 102:
|
||||||
case 42:
|
case 42:
|
||||||
term.current_color = LTGREEN;
|
term.current_bgcolor = LTGREEN;
|
||||||
break;
|
break;
|
||||||
case 103:
|
case 103:
|
||||||
case 43:
|
case 43:
|
||||||
term.current_color = YELLOW;
|
term.current_bgcolor = YELLOW;
|
||||||
break;
|
break;
|
||||||
case 104:
|
case 104:
|
||||||
case 44:
|
case 44:
|
||||||
term.current_color = LTBLUE;
|
term.current_bgcolor = LTBLUE;
|
||||||
break;
|
break;
|
||||||
case 105:
|
case 105:
|
||||||
case 45:
|
case 45:
|
||||||
term.current_color = LTPURPLE;
|
term.current_bgcolor = LTPURPLE;
|
||||||
break;
|
break;
|
||||||
case 106:
|
case 106:
|
||||||
case 46:
|
case 46:
|
||||||
term.current_color = LTCYAN;
|
term.current_bgcolor = LTCYAN;
|
||||||
break;
|
break;
|
||||||
case 107:
|
case 107:
|
||||||
case 47:
|
case 47:
|
||||||
term.current_color = LTGRAY;
|
term.current_bgcolor = LTGRAY;
|
||||||
break;
|
break;
|
||||||
case 49:
|
case 49:
|
||||||
// reset
|
// reset
|
||||||
term.current_color = BLACK;
|
term.current_bgcolor = BLACK;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue