]> granicus.if.org Git - neomutt/commitdiff
Permit tab completion of pattern expressions with ~y (labels).
authorDavid Champion <dgc@bikeshed.us>
Fri, 8 Apr 2016 00:08:58 +0000 (01:08 +0100)
committerRichard Russon <rich@flatcap.org>
Tue, 17 May 2016 16:27:52 +0000 (17:27 +0100)
copy.c
enter.c

diff --git a/copy.c b/copy.c
index 231fb510b0ef87e2553a15e71d2c498812a4708d..400239ea3d470083850aad9352d0ae78770a8783 100644 (file)
--- a/copy.c
+++ b/copy.c
@@ -431,7 +431,8 @@ mutt_copy_header (FILE *in, HEADER *h, FILE *out, int flags, const char *prefix)
       char *tmp = NULL;
       int fail = 0;
 
-      if (fail == 0 && (h->env->kwtypes & M_X_LABEL) &&
+      if (fail == 0 &&
+          ((h->env->kwtypes & M_X_LABEL) || (h->env->kwtypes == 0)) &&
           (option(OPTKEYWORDSLEGACY) || option(OPTKEYWORDSSTANDARD) == 0))
       {
         mutt_labels(buf, sizeof(buf), h->env, XlabelDelim);
diff --git a/enter.c b/enter.c
index f5410d33885b785bd0974fa1fa47577d78d5020e..d1373ead35397de2e445a771ac1f76afd6e5fc9d 100644 (file)
--- a/enter.c
+++ b/enter.c
@@ -567,7 +567,6 @@ int _mutt_enter_string (char *buf, size_t buflen, int y, int x,
          }
          else if (flags & M_LABEL && ch == OP_EDITOR_COMPLETE)
          {
-           /* invoke the alias-menu to get more addresses */
            for (i = state->curpos; i && state->wbuf[i-1] != ',' && 
                 state->wbuf[i-1] != ':'; i--)
              ;
@@ -583,6 +582,32 @@ int _mutt_enter_string (char *buf, size_t buflen, int y, int x,
            }
            break;
          }
+         else if (flags & M_PATTERN && ch == OP_EDITOR_COMPLETE)
+         {
+        char *p;
+           for (i = state->curpos; i && state->wbuf[i-1] != ',' && 
+                state->wbuf[i-1] != ':'; i--)
+             ;
+           for (; i < state->lastchar && state->wbuf[i] == ' '; i++)
+             ;
+           my_wcstombs (buf, buflen, state->wbuf + i, state->curpos - i);
+        p = &buf[i];
+        while (p > buf && *(p-1) != '~')
+          p--;
+        if (*p == '~' && *(p+1) == 'y')
+        {
+             r = mutt_label_complete (buf, buflen, i, state->tabs);
+             replace_part (state, i, buf);
+             if (!r)
+             {
+               rv = 1;
+               goto bye;
+             }
+        }
+        else
+          goto self_insert;
+           break;
+         }
          else if (flags & M_ALIAS && ch == OP_EDITOR_COMPLETE_QUERY)
          {
            /* invoke the query-menu to get more addresses */