Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Questions about completion matchers
- X-seq: zsh-users 27222
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Marlon Richert <marlon.richert@xxxxxxxxx>
- Cc: Oliver Kiddle <opk@xxxxxxx>, Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: Questions about completion matchers
- Date: Sat, 9 Oct 2021 09:23:42 -0700
- Archived-at: <https://zsh.org/users/27222>
- In-reply-to: <CAHLkEDv=+A7BXF6nKADNJDnd-zLW5baZ8xU3erp28it+jAKNrg@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- References: <CAHLkEDuT6iGYEivrHcML-dEaTMJUiGy-p39=2=kDEw1gL0i=Ew@mail.gmail.com> <20296-1632661753.678317@ipjb.25sX.Whnd> <CAHLkEDv=+A7BXF6nKADNJDnd-zLW5baZ8xU3erp28it+jAKNrg@mail.gmail.com>
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