summaryrefslogtreecommitdiff
path: root/Completion/Unix
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2010-08-06 15:29:58 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2010-08-06 15:29:58 +0000
commite1b6b572ab7cf098cae08103188b250b9170f5d4 (patch)
tree4b8679c212cb6f2ebdb204e6bc92f0d2a1242875 /Completion/Unix
parent857ea44b988daa0a76bc110e3377416ffb44360e (diff)
downloadzsh-e1b6b572ab7cf098cae08103188b250b9170f5d4.tar.gz
zsh-e1b6b572ab7cf098cae08103188b250b9170f5d4.zip
users/15232: _path_files for paths, again
Diffstat (limited to 'Completion/Unix')
-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