about summary refs log tree commit diff
path: root/Completion/Core
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Core')
-rw-r--r--Completion/Core/_expand13
1 files changed, 8 insertions, 5 deletions
diff --git a/Completion/Core/_expand b/Completion/Core/_expand
index 712052b16..f75c626d3 100644
--- a/Completion/Core/_expand
+++ b/Completion/Core/_expand
@@ -35,11 +35,14 @@ exp=("$word")
 # changes quoted spaces, tabs, and newlines into spaces and protects
 # this function from aborting on parse errors in the expansion.
 
-{ zstyle -s ":completion:${curcontext}:" substitute expr ||
-  { [[ "$curcontext" = expand-word:* ]] && expr=1 } } &&
-    [[ "${(e):-\$[$expr]}" -eq 1 ]] &&
-    exp=( ${(f)"$(print -lR - ${(e)exp//\\[ 	
+if { zstyle -s ":completion:${curcontext}:" substitute expr ||
+     { [[ "$curcontext" = expand-word:* ]] && expr=1 } } &&
+       [[ "${(e):-\$[$expr]}" -eq 1 ]]; then
+  exp=( ${(f)"$(print -lR - ${(e)exp//\\[ 	
 ]/ })"} ) 2>/dev/null
+else
+  exp=( "${exp:s/\\\$/\$}" )
+fi
 
 # If the array is empty, store the original string again.
 
@@ -117,7 +120,7 @@ else
       if [[ -d "$i" && "$i" != */ ]]; then
         dir=( "$dir[@]" "$i" )
       else
-	normal=( "$dir[@]" "$i" )
+	normal=( "$normal[@]" "$i" )
       fi
     done
     (( $#dir ))    && compadd "$expl[@]" -UQ -qS/ - "$dir[@]"