X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=pager.c;h=3f1db6e35c614331dbc2f862b720eac6eec3d1d5;hp=05e2c3e4a8a910d572e2827f5eff80f3e783fd53;hb=5f0d69cc13a116be64a243c07bad259af7d90397;hpb=b71c0979112af784bfa104e6abfb7072a84a00dd diff --git a/pager.c b/pager.c index 05e2c3e..3f1db6e 100644 --- a/pager.c +++ b/pager.c @@ -217,16 +217,13 @@ resolve_color (struct line_t *lineInfo, int n, int cnt, int flags, /* handle "special" bold & underlined characters */ if (special || a->attr) { -#ifdef HAVE_COLOR if ((a->attr & ANSI_COLOR)) { if (a->pair == -1) a->pair = mutt_alloc_color (a->fg, a->bg); color = a->pair; if (a->attr & ANSI_BOLD) color |= A_BOLD; - } - else -#endif + } else if ((special & A_BOLD) || (a->attr & ANSI_BOLD)) { if (ColorDefs[MT_COLOR_BOLD] && !search) color = ColorDefs[MT_COLOR_BOLD]; @@ -314,21 +311,15 @@ shift_class_colors (struct q_class_t *QuoteList, struct q_class_t *new_class, (*q_level)++; } -static void cleanup_quote (struct q_class_t **QuoteList) +static void cleanup_quote(struct q_class_t **QuoteList) { - struct q_class_t *ptr; - - while (*QuoteList) { - if ((*QuoteList)->down) - cleanup_quote (&((*QuoteList)->down)); - ptr = (*QuoteList)->next; - if ((*QuoteList)->prefix) - p_delete(&(*QuoteList)->prefix); - p_delete(QuoteList); - *QuoteList = ptr; - } - - return; + while (*QuoteList) { + struct q_class_t *ptr = (*QuoteList)->next; + cleanup_quote(&(*QuoteList)->down); + p_delete(&(*QuoteList)->prefix); + p_delete(QuoteList); + *QuoteList = ptr; + } } static struct q_class_t *classify_quote (struct q_class_t **QuoteList, @@ -771,10 +762,8 @@ static int grok_ansi (unsigned char *buf, int pos, ansi_attr * a) /* Character Attributes */ if (option (OPTALLOWANSI) && a != NULL && buf[x] == 'm') { if (pos == x) { -#ifdef HAVE_COLOR if (a->pair != -1) mutt_free_color (a->fg, a->bg); -#endif a->attr = ANSI_OFF; a->pair = -1; } @@ -803,10 +792,8 @@ static int grok_ansi (unsigned char *buf, int pos, ansi_attr * a) pos += 2; } else if (buf[pos] == '3' && isdigit (buf[pos + 1])) { -#ifdef HAVE_COLOR if (a->pair != -1) mutt_free_color (a->fg, a->bg); -#endif a->pair = -1; a->attr |= ANSI_COLOR; if (buf[pos + 1] != '9') @@ -814,10 +801,8 @@ static int grok_ansi (unsigned char *buf, int pos, ansi_attr * a) pos += 3; } else if (buf[pos] == '4' && isdigit (buf[pos + 1])) { -#ifdef HAVE_COLOR if (a->pair != -1) mutt_free_color (a->fg, a->bg); -#endif a->pair = -1; a->attr |= ANSI_COLOR; if (buf[pos + 1] != '9') @@ -1348,8 +1333,8 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra) { static char searchbuf[STRING]; char buffer[LONG_STRING]; - char helpstr[SHORT_STRING * 2]; - char tmphelp[SHORT_STRING * 2]; + char helpstr[STRING * 2]; + char tmphelp[STRING * 2]; int maxLine, lastLine = 0; struct line_t *lineInfo; struct q_class_t *QuoteList = NULL; @@ -1683,8 +1668,8 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra) lineInfo[i].quote = NULL; p_realloc(&lineInfo[i].syntax, 1); - if (SearchCompiled && lineInfo[i].search) - p_delete(&(lineInfo[i].search)); + if (SearchCompiled) + p_delete(&lineInfo[i].search); } lastLine = 0; @@ -1857,8 +1842,7 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra) if (SearchCompiled) { regfree (&SearchRE); for (i = 0; i < lastLine; i++) { - if (lineInfo[i].search) - p_delete(&(lineInfo[i].search)); + p_delete(&lineInfo[i].search); lineInfo[i].search_cnt = -1; } } @@ -1871,8 +1855,7 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra) regfree (&SearchRE); for (i = 0; i < maxLine; i++) { /* cleanup */ - if (lineInfo[i].search) - p_delete(&(lineInfo[i].search)); + p_delete(&lineInfo[i].search); lineInfo[i].search_cnt = -1; } SearchFlag = 0; @@ -2161,8 +2144,8 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra) lineInfo[i].quote = NULL; p_realloc(&(lineInfo[i].syntax), 1); - if (SearchCompiled && lineInfo[i].search) - p_delete(&(lineInfo[i].search)); + if (SearchCompiled) + p_delete(&lineInfo[i].search); } if (SearchCompiled) { @@ -2531,12 +2514,12 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra) } } - cleanup_quote (&QuoteList); + cleanup_quote(&QuoteList); for (i = 0; i < maxLine; i++) { - p_delete(&(lineInfo[i].syntax)); - if (SearchCompiled && lineInfo[i].search) - p_delete(&(lineInfo[i].search)); + p_delete(&lineInfo[i].syntax); + if (SearchCompiled) + p_delete(&lineInfo[i].search); } if (SearchCompiled) { regfree (&SearchRE);