On Tue, Aug 30, 2016 at 06:18:37PM -0700, d...@bikeshed.us wrote:
>  enter.c |  27 ++++++++++++++++++++++++++-
>  1 files changed, 26 insertions(+), 1 deletions(-)
> 
> 
> # HG changeset patch
> # User David Champion <d...@bikeshed.us>
> # Date 1472606303 25200
> #      Tue Aug 30 18:18:23 2016 -0700
> # Node ID b18e00baf96e46fea51555eaede1a6ff7b9fcd06
> # Parent  ea53e34cfe2833ce95af60a28d83a6f86c3403c6
> Permit tab completion of pattern expressions with ~y (labels).
> 
> diff --git a/enter.c b/enter.c
> --- a/enter.c
> +++ b/enter.c
> @@ -568,7 +568,6 @@
>         }
>         else if (flags & MUTT_LABEL && ch == OP_EDITOR_COMPLETE)
>         {
> -         /* invoke the alias-menu to get more addresses */

Should this be part of the patch?

>           for (i = state->curpos; i && state->wbuf[i-1] != ',' && 
>                state->wbuf[i-1] != ':'; i--)
>             ;
> @@ -584,6 +583,32 @@
>           }
>           break;
>         }
> +       else if (flags & MUTT_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;
> +       }

Your patch mixes tabulations and whitespaces. I believe mutt's policy is
whitespaces only, so it would be nice to use only whitespaces for all
new code.

It also makes use of mutt_label_complete which doesn't exist at this
point. If there are patches that need to be reviewed in order, it would
be nice to group them in a numeroted serie/patchset.

Thanks,
-- 
Damien

Reply via email to