From 655e7d87b4cec3e954b64712dea1a24bfc0ea7b8 Mon Sep 17 00:00:00 2001 From: Andrew Pamment Date: Mon, 18 Sep 2017 10:54:11 +1000 Subject: [PATCH] Try to untab tabs in unmangle ansi --- mail_menu.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/mail_menu.c b/mail_menu.c index 755d3db..f914c43 100644 --- a/mail_menu.c +++ b/mail_menu.c @@ -809,7 +809,7 @@ void unmangle_ansi(char *body, int len, char **body_out, int *body_len) { int i, j, k; struct character_t ***fake_screen; int ansi; - + int tab; line_at = 1; char_at = 1; @@ -824,6 +824,12 @@ void unmangle_ansi(char *body, int len, char **body_out, int *body_len) { if (body[i] == '\r') { char_at = 1; line_at++; + } else if (body[i] == '\t') { + char_at += 8; + while (char_at > 80) { + line_at++; + char_at -= 80; + } } else { char_at++; while (char_at > 80) { @@ -967,6 +973,18 @@ void unmangle_ansi(char *body, int len, char **body_out, int *body_len) { if (body[i] == '\r') { char_at = 1; line_at++; + } else if (body[i] == '\t') { + for (tab = 0; tab < 8; tab++) { + if (line_at > line_count) line_at = line_count; + fake_screen[line_at -1][char_at - 1]->c = ' '; + fake_screen[line_at -1][char_at - 1]->fg = fg; + fake_screen[line_at -1][char_at - 1]->bg = bg; + char_at++; + while (char_at > 80) { + line_at++; + char_at -= 80; + } + } } else { if (line_at > line_count) line_at = line_count; fake_screen[line_at -1][char_at - 1]->c = body[i];