More work on ansi display

This commit is contained in:
Andrew Pamment 2016-04-22 19:51:46 +10:00
parent cd5790559f
commit 9583ea4b68

View File

@ -826,12 +826,12 @@ void read_message(int socket, struct user_record *user, struct msg_headers *msgh
s_putstring(socket, buffer); s_putstring(socket, buffer);
} else if (body[z] == 'A') { } else if (body[z] == 'A') {
j = atoi(&body[ansi + 2]); j = atoi(&body[ansi + 2]);
if (j == 0) { if (j == 0 && ansi + 3 == z) {
j = 1; j = 1;
} }
for (i=0;i<j;i++) { for (i=0;i<j;i++) {
if (lines - 1 >= 0) { if (lines - 1 >= 0) {
s_putstring(socket, "\e[1A"); s_putstring(socket, "\e[A");
lines--; lines--;
} else { } else {
break; break;
@ -839,12 +839,12 @@ void read_message(int socket, struct user_record *user, struct msg_headers *msgh
} }
} else if (body[z] == 'C') { } else if (body[z] == 'C') {
j = atoi(&body[ansi + 2]); j = atoi(&body[ansi + 2]);
if (j == 0) { if (j == 0 && ansi + 3 == z) {
j = 1; j = 1;
} }
for (i=0;i<j;i++) { for (i=0;i<j;i++) {
if (chars + 1 <= 79) { if (chars + 1 <= 79) {
s_putstring(socket, "\e[1C"); s_putstring(socket, "\e[C");
chars++; chars++;
} else { } else {
break; break;
@ -852,12 +852,12 @@ void read_message(int socket, struct user_record *user, struct msg_headers *msgh
} }
} else if (body[z] == 'B') { } else if (body[z] == 'B') {
j = atoi(&body[ansi + 2]); j = atoi(&body[ansi + 2]);
if (j == 0) { if (j == 0 && ansi + 3 == z) {
j = 1; j = 1;
} }
for (i=0;i<j;i++) { for (i=0;i<j;i++) {
if (lines + 1 <= 17) { if (lines + 1 <= 17) {
s_putstring(socket, "\e[1B"); s_putstring(socket, "\e[B");
lines++; lines++;
} else { } else {
break; break;
@ -865,12 +865,12 @@ void read_message(int socket, struct user_record *user, struct msg_headers *msgh
} }
} else if (body[z] == 'D') { } else if (body[z] == 'D') {
j = atoi(&body[ansi + 2]); j = atoi(&body[ansi + 2]);
if (j == 0) { if (j == 0 && ansi + 3 == z) {
j = 1; j = 1;
} }
for (i=0;i<j;i++) { for (i=0;i<j;i++) {
if (chars - 1 >= 0) { if (chars - 1 >= 0) {
s_putstring(socket, "\e[1D"); s_putstring(socket, "\e[D");
chars--; chars--;
} else { } else {
break; break;