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

ZSH 3.0.5 breaks script



Hi!

I installed 3.0.5, and since then my script for cd completion doesn't
work. I wrote it long ago (pre 3.x.x) and never changed since then (I
know, it could look better ... ;)

Currently I get:
bor@itsmx1:~%> cdTAB
bor@itsmx1:~%> cd ${temp_reply}/

instead of listing choices.

setopt gives:

autoparamslash                                                                  
autoremoveslash                                                                 
nobanghist                                                                      
nobeep                                                                          
extendedglob                                                                    
histignoredups                                                                  
ignoreeof                                                                       
interactive                                                                     
nolistbeep                                                                      
listtypes                                                                       
login                                                                           
magicequalsubst                                                                 
menucomplete                                                                    
monitor                                                                         
nonomatch                                                                       
numericglobsort                                                                 
shinstdin                                                                       
zle                                                                             

compctl for cd is:
cd -qUQ -K multi_cd_comp -S /

where multi_cd_comp is

local pref head sofar origtop newtop globdir="(-/)" wild cdpath_dirs i origpref temp_reply                                                                      
setopt localoptions nullglob rcexpandparam globdots                             
unsetopt markdirs globsubst shwordsplit                                         
                                                                                
pref="${1}$2"                                                                   
                                                                                
# Hack to allow programmable completion to select multicomp after a :           
# (e.g.                                                                         
# compctl -D -f -x 's[:]' -U -K multicomp                                       
# )                                                                             
                                                                                
pref="${pref#:}"                                                                
origpref="${pref}"                                                              
                                                                                
if [[ "$pref" == [/\~]* ]]; then                                                
  cdpath_dirs=('')                                                              
else                                                                            
  cdpath_dirs=("${cdpath[@]:-''}")                                              
fi                                                                              
                                                                                
reply=()                                                                        
temp_reply=('')                                                                 
                                                                                
for i in "${cdpath_dirs[@]}"; do                                                
  sofar=('')                                                                    
  origtop=""                                                                    
  if [[ -n "${i}" ]]; then                                                      
    pref=${i}/${origpref}                                                       
  else                                                                          
    pref=${origpref}                                                            
  fi                                                                            
  if [[ "$pref" = \~* ]]; then                                                  
    # If the string started with ~, save the head and what it will become.      
    origtop="${pref%%/*}"                                                       
    newtop=${~origtop}                                                          
    # Save the expansion as the bit matched already                             
    sofar=($newtop)                                                             
    pref="${pref#$origtop}"                                                     
  fi                                                                            
                                                                                
  while [[ -n "$pref" ]]; do                                                    
    [[ "$pref" = /* ]] && sofar=(${sofar}/) && pref="${pref#/}"                 
    head="${pref%%/*}"                                                          
    pref="${pref#$head}"                                                        
    if [[ -n "$pref" && -z $sofar[2] && -d "${sofar}$head" ]]; then             
      # Exactly matched directory: don't try to glob                            
      temp_reply=("${sofar}$head")                                              
    else                                                                        
      # if path segment contains wildcards, don't add another.                  
      if [[ "$head" = *[\*\?]* ]]; then                                         
        wild=                                                                   
      else                                                                      
        wild='*'                                                                
      fi                                                                        
      temp_reply=(${sofar}"${head}${wild}${globdir}")                           
      temp_reply=(${~temp_reply})                                               
    fi                                                                          
                                                                                
    [[ -z $temp_reply[1] ]] && temp_reply=() && break                           
    [[ -n $pref ]] && sofar=($temp_reply)                                       
  done                                                                          
                                                                                
  # Restore ~'s in front if there were any.                                     
  # There had better not be anything funny in $newtop.                          
  [[ -n "${i}" ]] && temp_reply=(${temp_reply#${i}/})                           
  if [[ -n "$origtop" ]]; then                                                  
    reply=(${reply} "$origtop"${temp_reply#$newtop})                            
  else                                                                          
    reply=(${reply} ${temp_reply})                                              
  fi                                                                            
done                                                                            
                                                                                
What's wrong?

-------------------------------------------------------------------------
Andrej Borsenkow 		Fax:   +7 (095) 252 01 05
SNI ITS Moscow			Tel:   +7 (095) 252 13 88

NERV:  borsenkow.msk		E-Mail: borsenkow.msk@xxxxxx
-------------------------------------------------------------------------




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