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

Re: _files -g <pattern> offers files that don't match the pattern and conversely



On Sat, Jul 15, 2023 at 9:51 AM Johan Grande <nahoj@xxxxxxxxx> wrote:
>
> Le 15/07/2023 à 18:16, Bart Schaefer a écrit :
> > On Sat, Jul 15, 2023 at 6:32 AM Johan Grande <nahoj@xxxxxxxxx> wrote:
> >>
> >> % _f() { _files -g 'c(.)' }; compdef _f f
> >> % f <tab>
> >> a  b       # even though 'a' and 'b' don't match the pattern
> >
> > The only way I can make this happen is if "a" and "b" are directories.
> > _files will complete local directory names if there are no matching
> > files.
>
> In my test they are regular files

Hmm.  OK, I can now reproduce this with both 5.8 and 5.9 _files but
only if there are no local directories either (e.g., with "a" "b" and
"d/" I get "d" only).

So the real reason here is that _files always tries the "directories"
and "all-files" tags if "globbed-files" doesn't find anything.
_path_files does not use the same tags list.




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