From e1b6b572ab7cf098cae08103188b250b9170f5d4 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Fri, 6 Aug 2010 15:29:58 +0000 Subject: users/15232: _path_files for paths, again --- Completion/Unix/Type/_path_files | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'Completion/Unix/Type') 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 -- cgit 1.4.1