From: Kevin McCarthy Date: Sun, 29 Jan 2017 02:47:26 +0000 (-0800) Subject: Minor fixes to the x-label patch from David. X-Git-Tag: neomutt-20170225~33^2~7 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c591f5833208c0fea52b38b9b3c813e18e488cfd;p=neomutt Minor fixes to the x-label patch from David. Add L10N comment to sort menu. Mark a couple strings for localization. Use ascii_strncasecmp() for the X-Label header comparison. Simplify label_message() using mutt library routines. Bind label editing to "Y" instead of "y". "y" is already used in the default sample muttrc to display mailboxes. --- diff --git a/copy.c b/copy.c index faf383894..23e094e64 100644 --- a/copy.c +++ b/copy.c @@ -125,7 +125,7 @@ mutt_copy_hdr (FILE *in, FILE *out, LOFF_T off_start, LOFF_T off_end, int flags, } if (flags & CH_UPDATE_LABEL && - mutt_strncasecmp ("X-Label:", buf, 8) == 0) + ascii_strncasecmp ("X-Label:", buf, 8) == 0) continue; if (!ignore && fputs (buf, out) == EOF) @@ -455,7 +455,7 @@ mutt_copy_header (FILE *in, HEADER *h, FILE *out, int flags, const char *prefix) } #endif - if (flags & CH_UPDATE_LABEL && h->xlabel_changed) + if (flags & CH_UPDATE_LABEL) { h->xlabel_changed = 0; if (h->env->x_label != NULL) diff --git a/curs_main.c b/curs_main.c index 75f61d95d..8b386de3b 100644 --- a/curs_main.c +++ b/curs_main.c @@ -2843,9 +2843,14 @@ int mutt_index_menu (void) if (rc > 0) { Context->changed = 1; menu->redraw = REDRAW_FULL; + /* L10N: This is displayed when the x-label on one or more + * messages is edited. */ mutt_message (_("%d labels changed."), rc); } else { + /* L10N: This is displayed when editing an x-label, but no messages + * were updated. Possibly due to canceling at the prompt or if the new + * label is the same as the old label. */ mutt_message (_("No labels changed.")); } break; diff --git a/headers.c b/headers.c index e51f5b41d..c6c2e7b8b 100644 --- a/headers.c +++ b/headers.c @@ -222,17 +222,9 @@ static int label_message(HEADER *hdr, char *new) { if (hdr == NULL) return 0; - if (hdr->env->x_label == NULL && new == NULL) + if (mutt_strcmp (hdr->env->x_label, new) == 0) return 0; - if (hdr->env->x_label != NULL && new != NULL && - strcmp(hdr->env->x_label, new) == 0) - return 0; - if (hdr->env->x_label != NULL) - FREE(&hdr->env->x_label); - if (new == NULL) - hdr->env->x_label = NULL; - else - hdr->env->x_label = safe_strdup(new); + mutt_str_replace (&hdr->env->x_label, new); return hdr->changed = hdr->xlabel_changed = 1; }