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

Re: Is this a bug or I'm completely lost?

On Thu, 4 Nov 2004, DervishD wrote:

>     compadd -k nameddirs userdirs
>     Then when I hit <TAB> I'm presented with the list of named
> directories and user directories, in that order. That's correct. But
> if I specify a starting letter (or any starting prefix) and I hit
> <TAB>, only the first array is considered as a list of possible
> matches.

It certainly appears that this is the intentional behavior of compadd -k, 
based on a look at the code.  If you specify multiple arrays in a single 
compadd, they're assumed to indicate a preference ordering (e.g. nameddirs 
xor userdirs) whereas if you use separate compadds they're cumulative.  
The code very explicitly stops searching as soon as a partial match has 
been found; the only reason you get all of them in your first example is 
that there are no partial matches.

Unless of course I'm misreading the code, which is entirely possible given 
that Sven W. is really the only person who has ever had all of this inside 
his brain at one time.

I'm reluctant to try to change it given that there may be some obscure 
dependence on this ... just because I can't think of a case where the 
existing completion fuctions pass more than one array name to compadd, 
doesn't mean there isn't one.

On the other hand I don't want to change the docs if it really is a bug. 
Can someone else (Oliver?  PWS?) take a look at compcore.c:addmatches() 
and give a second opinion?  (Search with /arrays/i).

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