Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Questions about completion matchers



On Fri, Oct 8, 2021 at 3:39 PM Marlon Richert <marlon.richert@xxxxxxxxx> wrote:
>
> The way I've understood it, is that, if $word contains the command line string for which completion is attempted, then each matcher should transform $word as follows:
>
> What did I miss?

I think what you've missed is that there are two things being
examined:  The word on the command line, and the "trial completion",
that is, the word passed to compadd that might replace the one on the
command line.  It's not merely (choosing the first of your seeming
duplications)

> *              b:$lpat=$tpat -> ${word/#$~lpat/$~tpat}
> *             l:|$lpat=$tpat -> ${word/#$~lpat/$~tpat}

Rather it's

*              b:$lpat=$tpat -> [[ $trial = ${~lpat}* ]] &&
${word/#$~lpat/$~tpat}
*             l:|$lpat=$tpat -> [[ $trial = *${~lpat}* ]] &&
${word/#$~lpat/$~tpat}

In the cases with r: and R:, $ranchor is only compared to $trial, it
is not used when replacing into $word.




Messages sorted by: Reverse Date, Date, Thread, Author