[PATCH 5 of 5] Permit tab completion of pattern expressions with ~y (labels)
# HG changeset patch
# User David Champion <dgc@xxxxxxxxxxxx>
# Date 1294082432 21600
# Branch HEAD
# Node ID 8233afda69c15a841208c6757d66f6f6ebfa255c
# Parent 32fa2504d528f3d84863712cb0874272e9f2c63d
Permit tab completion of pattern expressions with ~y (labels).
diff --git a/copy.c b/copy.c
--- a/copy.c
+++ b/copy.c
@@ -430,7 +430,8 @@
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
--- a/enter.c
+++ b/enter.c
@@ -531,7 +531,6 @@
}
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--)
;
@@ -547,6 +546,32 @@
}
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 */