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

Another multicomp nit



This bit of code:

  if [[ -n "$pref" && -z $sofar[2] && -d "${sofar}$head" ]]; then
    # Exactly matched directory: don't try to glob
    reply=("${sofar}$head")

Is obviously supposed to implement this behavior:

# Note that exactly matched directories are not expanded, e.g.
# s/zsh-2.4/s<TAB> will not expand to src/zsh-2.4old/src.

There seem to be an extremely limited number of cases where this applies.
For example,

zagzig% ls /u/s/l/z/zsh-3.1.4/s<TAB>

produces

zagzig% ls /usr/src/local/zsh/zsh-3.1.4-build/Src                     
/usr/src/local/zsh/zsh-3.1.4-build/Src
/usr/src/local/zsh/zsh-3.1.4-build/stamp-h.in
/usr/src/local/zsh/zsh-3.1.4-orig/Src
/usr/src/local/zsh/zsh-3.1.4-orig/StartupFiles
/usr/src/local/zsh/zsh-3.1.4-orig/stamp-h.in
/usr/src/local/zsh/zsh-3.1.4/Src
/usr/src/local/zsh/zsh-3.1.4/StartupFiles

Clearly, it expanded zsh-3.1.4, even though that's an exactly matched
directory.  The reason it doesn't work seems to be that, one level up,
/usr/src/local/zip also matches /u/s/l/z/.  See:

zagzig% ls /u/s/l/zsh/zsh-3.1.4/s<TAB>

produces

zagzig% ls /usr/src/local/zsh/zsh-3.1.4/Src                           
/usr/src/local/zsh/zsh-3.1.4/Src
/usr/src/local/zsh/zsh-3.1.4/StartupFiles

Is the exact-match test even worthwhile?

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



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