1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-17 12:41:14 +02:00

users/15232: _path_files for paths, again

This commit is contained in:
Peter Stephenson 2010-08-06 15:29:58 +00:00
parent 857ea44b98
commit e1b6b572ab
2 changed files with 12 additions and 7 deletions

View file

@ -1,7 +1,5 @@
2010-08-06 Peter Stephenson <pws@csr.com>
* 28131: MACHINES: latest status on Cygwin.
* users/15232: Completion/Unix/Type/_path_files: somehow
this didn't get completed.
@ -13494,5 +13492,5 @@
*****************************************************
* This is used by the shell to define $ZSH_PATCHLEVEL
* $Revision: 1.5050 $
* $Revision: 1.5049 $
*****************************************************

View file

@ -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