about summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Unix/Type/_path_files15
1 files changed, 11 insertions, 4 deletions
diff --git a/Completion/Unix/Type/_path_files b/Completion/Unix/Type/_path_files
index 581835efc..1f8be09b8 100644
--- a/Completion/Unix/Type/_path_files
+++ b/Completion/Unix/Type/_path_files
@@ -367,17 +367,24 @@ for prepath in "$prepaths[@]"; do
     # Explanation of substitution: For tmp1 and tpre, which are used further
     # on, we need to remove quotes from everything that's not a pattern
     # character, because the code that does the file generation only
-    # strips qutoes from pattern characters (you know better than
+    # strips quotes from pattern characters (you know better than
     # to ask why).  Because we need to test for a real directory,
     # however, for tmp2 we unquote everything.
     tmp1=${match[1]}
     tpre=${match[2]}
     tmp2=${(Q)tmp1}
-    tmp1=${tmp1//(#b)\\([^\\\]\[\^\~\(\)\#\*\?])/$match[1]}
+    tmp1=${tmp1//(#b)\\(?)/$match[1]}
     tpre=${tpre//(#b)\\([^\\\]\[\^\~\(\)\#\*\?])/$match[1]}
+    # Theory: donepath needs the quoting of special characters
+    # still in it.  However, we need it without at this point.
+    # (I think.)  Note this is different from the above where we're
+    # doing something a bit different.
+    tmp3=${donepath//(#b)\\(?)/$match[1]}
     while true; do
-      if [[ -z $path_completion || -d $prepath$realpath$donepath$tmp2 ]]; then
-	donepath=$donepath$tmp1/
+      if [[ -z $path_completion || -d $prepath$realpath$tmp3$tmp2 ]]; then
+	tmp3=$tmp3$tmp1/
+	# Now put donepath back the way it should be.  (I think.)
+	donepath=${tmp3//(#b)([\\\]\[\^\~\(\)\#\*\?])/\\$match[1]}
 	pre=$tpre
 	break
       elif [[ $tmp1 = (#b)(*)/([^/]#) ]]; then