diff --git a/mail_menu.c b/mail_menu.c index 59362d7..d377346 100644 --- a/mail_menu.c +++ b/mail_menu.c @@ -856,6 +856,15 @@ void unmangle_ansi(char *body, int len, char **body_out, int *body_len) { if (body[i] == '\r') { line_count++; line_at++; + } else if (body[i] != 27){ + char_at ++; + if (char_at == 80) { + char_at = 0; + line_at++; + if (line_at > line_count) { + line_count = line_at; + } + } } if (body[i] == 27) { @@ -877,10 +886,32 @@ void unmangle_ansi(char *body, int len, char **body_out, int *body_len) { if (line_at > line_count) { line_count = line_at; } + } else if (body[i] == 'C') { + if (i == ansi + 1) { + char_at++; + } else { + char_at += atoi(&body[ansi + 1]); + } + while (char_at >= 80) { + line_count++; + char_at -= 80; + } + + } else if (body[i] == 'D') { + if (i == ansi + 1) { + char_at--; + } else { + char_at -= atoi(&body[ansi + 1]); + } + while (char_at < 0) { + char_at = 0; + } + } } } + fake_screen = (struct character_t ***)malloc(sizeof(struct character_t **) * line_count); for (i=0;i