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

Is this a bug or I'm completely lost?



    Hi all :)

    If I run this script to setup a completion widget:

---
#!/bin/zsh

zle -C expand-or-complete expand-or-complete _completer

function _completer () {

    emulate -L zsh

    setopt extendedglob globdots globassign null_glob

    compstate[insert]=${compstate[insert]//tab /}

    compadd -k nameddirs userdirs

    return 0
}
---

    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. If I switch the order of the two arrays the behaviour is
reproducible: only the first one is used for matches.

    An example: if my named dirs are 'PWD' and 'OLDPWD' and my user dirs
are 'root' and 'user', with the script above I do:

    print r<TAB>

    and nothing is completed. If I switch the order of the array
names, it works, but then, with the order switched, I do:

    print P<TAB>

    and nothing is completed. If I change the compadd line in the
script above to:

    compadd -k nameddirs
    compadd -k userdirs

    then all works correctly, no matter the order.

    I'm using zsh-4.0.9, btw. I haven't found anything on the mailing
list archives nor in the changelogs (I have only the 4.1 changelogs).
Thanks!

    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