From: Kevin McCarthy Date: Tue, 31 Jan 2017 22:27:28 +0000 (-0800) Subject: Permit tab completion of pattern expressions with ~y (labels). X-Git-Tag: neomutt-20170225~32^2~7 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=73aa509a3d169613ba83259de8fe3dcd6cbd97c5;p=neomutt Permit tab completion of pattern expressions with ~y (labels). Thanks to David Champion for the original patch. This version is slightly different, as I couldn't get the original patch working. This version simply scans backward for the first ~, and if it is ~y, invokes completion. --- diff --git a/enter.c b/enter.c index d8fc2a513..db2e4977e 100644 --- a/enter.c +++ b/enter.c @@ -568,7 +568,6 @@ int _mutt_enter_string (char *buf, size_t buflen, int col, } else if (flags & MUTT_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--) ; @@ -584,6 +583,26 @@ int _mutt_enter_string (char *buf, size_t buflen, int col, } break; } + else if (flags & MUTT_PATTERN && ch == OP_EDITOR_COMPLETE) + { + for (i = state->curpos; i && state->wbuf[i-1] != '~'; i--) + ; + if (i && state->wbuf[i-1] == '~' && state->wbuf[i] == 'y') + { + i++; + my_wcstombs (buf, buflen, state->wbuf + i, state->curpos - i); + r = mutt_label_complete (buf, buflen, strlen (buf), state->tabs); + replace_part (state, i, buf); + if (!r) + { + rv = 1; + goto bye; + } + } + else + goto self_insert; + break; + } else if (flags & MUTT_ALIAS && ch == OP_EDITOR_COMPLETE_QUERY) { /* invoke the query-menu to get more addresses */