From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 519 invoked from network); 25 Feb 1999 09:31:37 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 25 Feb 1999 09:31:37 -0000 Received: (qmail 7073 invoked by alias); 25 Feb 1999 09:12:47 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 5516 Received: (qmail 7047 invoked from network); 25 Feb 1999 09:12:43 -0000 Message-Id: <9902241703.AA53847@ibmth.df.unipi.it> To: zsh-workers@sunsite.auc.dk (Zsh hackers list) Subject: PATCH: _path_files -/ Date: Wed, 24 Feb 1999 18:03:36 +0100 From: Peter Stephenson Here's a small patch which stops _path_files -/ from returning matches for non-directories when the path before the last component gets expanded. Maybe Sven has a better way of doing this. One thing I'm not sure about is that (e.g.) ./F/C/ doesn't give ./Functions/Completion/ because it wants another directory after the final /. The question is whether we should get any directory under that one, when there is one, or whether in the first instance we should get ./Functions/Completion/, which is what you would get if that last slash wasn't there, and only next start completing in the directory. --- Functions/Completion/_path_files.bk Wed Feb 24 17:54:45 1999 +++ Functions/Completion/_path_files Wed Feb 24 17:54:49 1999 @@ -26,7 +26,7 @@ # Yes, so... local nm prepaths str linepath realpath donepath patstr prepath testpath rest -local tmp1 collect tmp2 suffixes i ignore matchflags +local tmp1 collect tmp2 suffixes i ignore matchflags comp_dirs setopt localoptions nullglob rcexpandparam globdots extendedglob unsetopt markdirs globsubst shwordsplit nounset @@ -87,6 +87,7 @@ complist "$tmp1[@]" -g "$argv[2,-1]" shift else + [[ $1 = -/ ]] && comp_dirs=1 complist "$tmp1[@]" $1 shift fi @@ -206,6 +207,7 @@ collect=() suffixes=( $rest$@ ) suffixes=( "${(@)suffixes:gs.**.*.}" ) + [[ -n $comp_dirs ]] && suffixes=( ${suffixes}"(-/)" ) # In the loop the prefixes from the `tmp1' array produced above and # the suffixes we just built are used to produce possible matches @@ -277,6 +279,7 @@ tmp1="$prepath$realpath$testpath" suffixes=( $str$@ ) suffixes=( "${(@)suffixes:gs.**.*.}" ) + [[ -n $comp_dirs ]] && suffixes=( ${suffixes}"(-/)" ) tmp2=( ${~tmp1}${~matchflags}${~suffixes} ) compadd -p "$linepath$testpath" -W "$prepath$realpath$testpath" -f "$ignore[@]" - ${tmp2#$tmp1} done -- Peter Stephenson Tel: +39 050 844536 WWW: http://www.ifh.de/~pws/ Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy