From 152efdb28c2e871ab87781e519091c86201cd48d Mon Sep 17 00:00:00 2001 From: Thomas Roessler Date: Tue, 17 Nov 1998 09:22:18 +0000 Subject: [PATCH] Fix a search coloring related bug. --- pager.c | 10 +++++++--- parse.c | 49 +++++++++++++------------------------------------ pgp.c | 11 +---------- postpone.c | 12 +----------- 4 files changed, 22 insertions(+), 60 deletions(-) diff --git a/pager.c b/pager.c index c4ea29d9..f4a110b8 100644 --- a/pager.c +++ b/pager.c @@ -55,7 +55,7 @@ static const char rcsid[]="$Id$"; #define CHECK_MODE(x) if (!(x)) \ { \ mutt_flushinp (); \ - mutt_error ("Not available in this menu."); \ + mutt_error _("Not available in this menu."); \ break; \ } @@ -69,7 +69,7 @@ static const char rcsid[]="$Id$"; #define CHECK_ATTACH if(option(OPTATTACHMSG)) \ {\ mutt_flushinp (); \ - mutt_error ("Function not permitted in attach-message mode."); \ + mutt_error _("Function not permitted in attach-message mode."); \ break; \ } @@ -1020,6 +1020,10 @@ display_line (FILE *f, long *last_pos, struct line_t **lineInfo, int n, resolve_types ((char *) fmt, *lineInfo, n, *last, QuoteList, q_level, force_redraw, flags & M_SHOWCOLOR); + + /* avoid race condition for continuation lines when scrolling up */ + for (m = n + 1; m < *last && (*lineInfo)[m].offset && (*lineInfo)[m].continuation; m++) + (*lineInfo)[m].type = (*lineInfo)[n].type; } /* this also prevents searching through the hidden lines */ @@ -1028,7 +1032,7 @@ display_line (FILE *f, long *last_pos, struct line_t **lineInfo, int n, } /* At this point, (*lineInfo[n]).quote may still be undefined. We - * don't wont to compute it every time M_TYPES is set, since this + * don't want to compute it every time M_TYPES is set, since this * would slow down the "bottom" function unacceptably. A compromise * solution is hence to call regexec() again, just to find out the * length of the quote prefix. diff --git a/parse.c b/parse.c index 97f8c058..a8f9cbf0 100644 --- a/parse.c +++ b/parse.c @@ -427,6 +427,17 @@ void mutt_parse_part (FILE *fp, BODY *b) b->parts = mutt_read_mime_header (fp, 0); } break; + + default: + return; + } + + /* try to recover from parsing error */ + if (!b->parts) + { + b->type = TYPETEXT; + safe_free ((void **) &b->subtype); + b->subtype = safe_strdup ("plain"); } } @@ -459,21 +470,7 @@ BODY *mutt_parse_messageRFC822 (FILE *fp, BODY *parent) if (msg->length < 0) msg->length = 0; - if (msg->type == TYPEMULTIPART) - msg->parts = mutt_parse_multipart (fp, mutt_get_parameter ("boundary", msg->parameter), msg->offset + msg->length, mutt_strcasecmp ("digest", msg->subtype) == 0); - else if (msg->type == TYPEMESSAGE) - msg->parts = mutt_parse_messageRFC822 (fp, msg); - else - return (msg); - - /* try to recover from parsing error */ - if (!msg->parts) - { - msg->type = TYPETEXT; - safe_free ((void **) &msg->subtype); - msg->subtype = safe_strdup ("plain"); - } - + mutt_parse_part(fp, msg); return (msg); } @@ -813,27 +810,7 @@ void mutt_parse_mime_message (CONTEXT *ctx, HEADER *cur) if ((msg = mx_open_message (ctx, cur->msgno))) { - fseek (msg->fp, cur->content->offset, 0); - - if (cur->content->type == TYPEMULTIPART) - { - if (!cur->content->parts) - cur->content->parts = mutt_parse_multipart (msg->fp, mutt_get_parameter ("boundary", cur->content->parameter), cur->content->offset + cur->content->length, mutt_strcasecmp ("digest", cur->content->subtype) == 0); - } - else - { - if (!cur->content->parts) - cur->content->parts = mutt_parse_messageRFC822 (msg->fp, cur->content); - } - - /* try to recover from parsing error */ - if (!cur->content->parts) - { - cur->content->type = TYPETEXT; - safe_free ((void **) &cur->content->subtype); - cur->content->subtype = safe_strdup ("plain"); - } - + mutt_parse_part (msg->fp, cur->content); #ifdef _PGPPATH diff --git a/pgp.c b/pgp.c index a3c41977..68041be4 100644 --- a/pgp.c +++ b/pgp.c @@ -908,16 +908,7 @@ BODY *pgp_decrypt_part (BODY *a, STATE *s, FILE *fpout) /* See if we need to recurse on this MIME part. */ - if (tattach->type == TYPEMULTIPART) - { - fseek (fpout, tattach->offset, 0); - tattach->parts = mutt_parse_multipart (fpout, mutt_get_parameter ("boundary", tattach->parameter), tattach->offset + tattach->length, mutt_strcasecmp ("digest", tattach->subtype) == 0); - } - else if (tattach->type == TYPEMESSAGE) - { - fseek (fpout, tattach->offset, 0); - tattach->parts = mutt_parse_messageRFC822 (fpout, tattach); - } + mutt_parse_part (fpout, tattach); } return (tattach); diff --git a/postpone.c b/postpone.c index cdf9a572..31b7ea3d 100644 --- a/postpone.c +++ b/postpone.c @@ -405,17 +405,7 @@ int mutt_prepare_edit_message (CONTEXT *ctx, HEADER *newhdr, HEADER *hdr) { BODY *b; - fseek (msg->fp, hdr->content->offset, 0); - - if (hdr->content->type == TYPEMULTIPART) - { - hdr->content->parts = mutt_parse_multipart (msg->fp, - mutt_get_parameter ("boundary", hdr->content->parameter), - hdr->content->offset + hdr->content->length, - mutt_strcasecmp ("digest", hdr->content->subtype) == 0); - } - else - hdr->content->parts = mutt_parse_messageRFC822 (msg->fp, hdr->content); + mutt_parse_part (msg->fp, hdr->content); /* Now that we know what was in the other message, convert to the new * message. -- 2.40.0