about summary refs log tree commit diff
path: root/Completion/Core/_expand
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Core/_expand')
-rw-r--r--Completion/Core/_expand7
1 files changed, 4 insertions, 3 deletions
diff --git a/Completion/Core/_expand b/Completion/Core/_expand
index 1a96e654e..293ad3649 100644
--- a/Completion/Core/_expand
+++ b/Completion/Core/_expand
@@ -32,13 +32,14 @@ fi
 exp=("$word")
 
 # First try substitution. That weird thing spanning multiple lines
-# changes quoted spaces, tabs, and newlines into spaces.
+# 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=( "${(e)exp//\\[ 	
-]/ }" )
+    exp=( ${(f)"$(print -lR - ${(e)exp//\\[ 	
+]/ } 2>/dev/null)"} )
 
 # If the array is empty, store the original string again.