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

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



    Hi Bart :)

 * Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> dixit:
> >     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.  

    I assumed that, that's the reason I used a single compadd command
in the first place ;)

> 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.

    The problem is that a partial match is not found. In fact, what
happens here is that if a match is not found in the first array, the
second is not even tried. Am I missing something?

> 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.

    I'm with you... if this is a feature and not a bug.

    If, for example, you have 'cd r' in the command line and do
completion, and the first array has an entry called 'right' and the
second has one called 'rong', I find more or less intuitive and
useful that only 'right' is presented as a match, because you
specified and order when using one compadd command with two arrays.
The problem is that if the first array has no entry that matches that
'r', the second array is not even tried :(( For me this is a bug.

    Raúl Núñez de Arenas Coronado

-- 
Linux Registered User 88736
http://www.dervishd.net & http://www.pleyades.net/



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