X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=pager.c;fp=pager.c;h=eee9b8393290123f17fe8aa42e11db5e0471a45b;hp=7132f32b3aa01458b29273c4983d6a902cf60947;hb=7dcd7ee09b8760133ac8ec00562e4d60b2f0aebd;hpb=f5276054ef65648b1d1ab00664c0a3ea6879cf39 diff --git a/pager.c b/pager.c index 7132f32..eee9b83 100644 --- a/pager.c +++ b/pager.c @@ -745,73 +745,6 @@ static int check_attachment_marker(char *p) return (int)(*p - *q); } -static int grok_ansi (unsigned char *buf, int pos, ansi_attr * a) -{ - int x = pos; - - while (isdigit (buf[x]) || buf[x] == ';') - x++; - - /* Character Attributes */ - if (option (OPTALLOWANSI) && a != NULL && buf[x] == 'm') { - if (pos == x) { - if (a->pair != -1) - mutt_free_color (a->fg, a->bg); - a->attr = ANSI_OFF; - a->pair = -1; - } - a->bg = -2; - a->fg = -2; - while (pos < x) { - if (buf[pos] == '1' && (pos + 1 == x || buf[pos + 1] == ';')) { - a->attr |= ANSI_BOLD; - pos += 2; - } - else if (buf[pos] == '4' && (pos + 1 == x || buf[pos + 1] == ';')) { - a->attr |= ANSI_UNDERLINE; - pos += 2; - } - else if (buf[pos] == '5' && (pos + 1 == x || buf[pos + 1] == ';')) { - a->attr |= ANSI_BLINK; - pos += 2; - } - else if (buf[pos] == '7' && (pos + 1 == x || buf[pos + 1] == ';')) { - a->attr |= ANSI_REVERSE; - pos += 2; - } - else if (buf[pos] == '0' && (pos + 1 == x || buf[pos + 1] == ';')) { - a->bg = -2; - a->fg = -2; - pos += 2; - } - else if (buf[pos] == '3' && isdigit (buf[pos + 1])) { - if (a->pair != -1) - mutt_free_color (a->fg, a->bg); - a->pair = -1; - a->attr |= ANSI_COLOR; - if (buf[pos + 1] != '9') - a->fg = buf[pos + 1] - '0'; - pos += 3; - } - else if (buf[pos] == '4' && isdigit (buf[pos + 1])) { - if (a->pair != -1) - mutt_free_color (a->fg, a->bg); - a->pair = -1; - a->attr |= ANSI_COLOR; - if (buf[pos + 1] != '9') - a->bg = buf[pos + 1] - '0'; - pos += 3; - } else { - while (pos < x && buf[pos] != ';') - pos++; - pos++; - } - } - } - pos = x; - return pos; -} - /* trim tail of buf so that it contains complete multibyte characters */ static int trim_incomplete_mbyte(unsigned char *buf, size_t len) { mbstate_t mbstate; @@ -912,8 +845,10 @@ static int format_line (struct line_t **lineInfo, int n, unsigned char *buf, for (ch = 0, vch = 0; ch < cnt; ch += k, vch += k) { /* Handle ANSI sequences */ while (cnt - ch >= 2 && buf[ch] == '\033' && buf[ch + 1] == '[' && - is_ansi (buf + ch + 2)) - ch = grok_ansi (buf, ch + 2, pa) + 1; + is_ansi (buf + ch + 2)) { + while (isdigit(buf[ch]) || buf[ch] == ';') + ch++; + } while (cnt - ch >= 2 && buf[ch] == '\033' && buf[ch + 1] == ']' && check_attachment_marker ((char *) buf + ch) == 0) { @@ -1361,19 +1296,11 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra) indicator = indexlen / 3; - if (option (OPTSTATUSONTOP)) { - indexoffset = 0; - statusoffset = IsHeader (extra) ? indexlen : 0; - bodyoffset = statusoffset + 1; - helpoffset = LINES - 2; - bodylen = helpoffset - bodyoffset; - } else { - helpoffset = 0; - indexoffset = 1; - statusoffset = LINES - 2; - bodyoffset = indexoffset + (IsHeader (extra) ? indexlen : 0); - bodylen = statusoffset - bodyoffset; - } + indexoffset = 0; + statusoffset = IsHeader (extra) ? indexlen : 0; + bodyoffset = statusoffset + 1; + helpoffset = LINES - 2; + bodylen = helpoffset - bodyoffset; SETCOLOR(main_w, MT_COLOR_STATUS); wmove(main_w, helpoffset, 0); @@ -1406,7 +1333,7 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra) } SETCOLOR(main_w, MT_COLOR_NORMAL); - pager_index->offset = indexoffset + (option (OPTSTATUSONTOP) ? 1 : 0); + pager_index->offset = indexoffset + 1; pager_index->pagelen = indexlen - 1; @@ -1520,7 +1447,7 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra) sidebar_draw (); /* print out the pager_index status bar */ menu_status_line (buffer, sizeof (buffer), pager_index, NONULL (Status)); - wmove(main_w, indexoffset + (option(OPTSTATUSONTOP) ? 0 : (indexlen - 1)), 0); + wmove(main_w, indexoffset + 0, 0); SETCOLOR(main_w, MT_COLOR_STATUS); BKGDSET(main_w, MT_COLOR_STATUS); mutt_paddstr(main_w, getmaxx(main_w), buffer);