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

Re: _path_files -W change



Peter Stephenson wrote:

> This used to work.  Has it officially stopped?  MH folder completion
> currently won't work because of it.  That can be trivially changed if the
> new behaviour is correct.
> 
> foopath=~/Mail
> compdef _foo foo
> foo() { _path_files -W foopath -/ }
> foo <TAB>
> 
> used to expand $foopath and complete directories, now doesn't.

It got confused because there wasn't a trailing slash. This patch
should make this as convenient as possible, i.e. the -W paths may or
may not have a trailing slash.

Bye
 Sven

diff -u -r oldcompletion/Core/_path_files Completion/Core/_path_files
--- oldcompletion/Core/_path_files	Fri Dec  3 16:42:42 1999
+++ Completion/Core/_path_files	Mon Dec  6 10:26:28 1999
@@ -39,10 +39,10 @@
          ;;
   W)     tmp1="$OPTARG"
          if [[ "$tmp1[1]" = '(' ]]; then
-           prepaths=( ${^=tmp1[2,-2]}/ )
+           prepaths=( ${^=tmp1[2,-2]%/}/ )
          else
-           prepaths=( ${(P)=${tmp1}} )
-           (( ! $#prepaths )) && prepaths=( ${tmp1}/ )
+           prepaths=( ${(P)^=tmp1%/}/ )
+           (( ! $#prepaths )) && prepaths=( ${tmp1%/}/ )
          fi
          (( ! $#prepaths )) && prepaths=( '' )
          ;;

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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