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

Re: Questions about completion matchers



On Sat, Oct 9, 2021 at 3:12 PM Marlon Richert <marlon.richert@xxxxxxxxx> wrote:
>
> On Sat, Oct 9, 2021 at 7:23 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> >
> > *             l:|$lpat=$tpat -> [[ $trial = *${~lpat}* ]] &&
> > ${word/#$~lpat/$~tpat}
>
> Perhaps I'm mistaken, but aren't you mixing up $lpat and $lanchor
> here?

Well, sort of, yes.  See Oliver's more recent message.  A better
description of what's happening is that the matcher transforms the
word from the command line into a pattern, and then that pattern is
compared to every one of the trial candidates, and then pieces of the
trial candidates are extracted and merged with the word from the
command line to generate the list of possible replacements for that
word.  It's never as simple as a string substitution on the word
itself taken directly from the patterns in the matcher.

> How about changing the docs to just literally state the transformation
> that each matcher applies?

Because it's not a literal transformation.  Matchers don't transform,
they create a comparison between the command line and the compadd
strings and define which parts of the command line can be replaced by
what parts of the compadd strings when that comparison finds a match.




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