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

PATCH: Re: couple of problems with _expand



Danek Duvall wrote:

> These are with 3.1.9-dev-1.  I can replicate with zsh -f, running compinit,
> and setting the only completer to _expand.
> 
> 1)
> % echo -$COL<TAB>
> 
>   leaves
> 
> % echo -

Oops. Better don't try to expand with such a partially typed parameter 
expansion.

> 2)
> % echo ${ZSH_<TAB>
> _expand:58: bad substitution

This is already fixed.

Bye
 Sven

Index: Completion/Core/_expand
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_expand,v
retrieving revision 1.22
diff -u -r1.22 _expand
--- Completion/Core/_expand	2000/06/29 07:10:31	1.22
+++ Completion/Core/_expand	2000/06/29 08:07:06
@@ -33,7 +33,9 @@
   word="$IPREFIX$PREFIX$SUFFIX$ISUFFIX"
 fi
 
-[[ "$word" = *\$\{[^\}]# ]] && return 1
+[[ "$word" = *\$(|\{[^\}]#) ||
+   ( "$word" = *\$[a-zA-Z0-9_]## && $+parameters[${word##*\$}] -eq 0 ) ]] &&
+    return 1
 
 zstyle -T ":completion:${curcontext}:" suffix &&
   [[ "$word" = (\~*/|\$(|[=~#^+])[a-zA-Z0-9_\[\]]##[^a-zA-Z0-9_\[\]]|\$\{*\}?)[^\$\{\}\(\)\<\>?^*#~]# ]] &&
@@ -44,8 +46,8 @@
   { [[ "$word" = \~(|[-+]) ||
        ( "$word" = \~[-+][1-9]## && $word[3,-1] -le $#dirstack ) ||
        ( "$word" = \~* && ${#userdirs[(I)${word[2,-1]}*]}+${#nameddirs[(I)${word[2,-1]}*]} -ne 1 ) ||
-       ( "$word" = \$[a-zA-Z0-9_]## && 
-         ${#parameters[(I)${word[2,-1]}*]} -ne 1 ) ]] && return 1 }
+       ( "$word" = *\$[a-zA-Z0-9_]## && 
+         ${#parameters[(I)${word##*\$}*]} -ne 1 ) ]] && return 1 }
 
 # In exp we will collect the expansions.
 

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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