Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH (?) Re: Regression in braces completion



On Oct 13,  5:27pm, Peter Stephenson wrote:
}
} > I wasn't suggesting treating this as a special case, I was suggesting
} > that _path_files treat a spelling correction in the path prefix as a
} > special case.  That's the stated reason why _path_files is using -U.
} 
} As you previously noted, there are already far too many ways of running
} compadd within _path_files as it is.  I'm not at all happy about
} doubling the number to get sets with and without -U --- which would
} leave spelling correction broken in the case where braces are present

Somebody tell me what's wrong with this.  Doesn't seem to break spelling
correction in the path prefix when braces are present, and doesn't seem
to break braces when spelling correction isn't present, and doesn't add
any new calls to compadd; just changes whether the ones that are there
get -U passed in.

What am I missing?


--- ../zsh-forge/current/Completion/Unix/Type/_path_files	2008-09-02 20:09:04.000000000 -0700
+++ Completion/Unix/Type/_path_files	2008-10-13 21:31:53.000000000 -0700
@@ -7,7 +7,7 @@
 local tmp1 tmp2 tmp3 tmp4 i orig eorig pre suf tpre tsuf opre osuf cpre
 local pats haspats ignore pfx pfxsfx sopt gopt opt sdirs ignpar cfopt listsfx
 local nm=$compstate[nmatches] menu matcher mopts sort mid accex fake
-local listfiles listopts tmpdisp origtmp1
+local listfiles listopts tmpdisp origtmp1 Uopt
 integer npathcheck
 local -a match mbegin mend
 
@@ -209,7 +209,7 @@
 [[ $compstate[insert] = (*menu|[0-9]*) || -n "$_comp_correct" ||
    ( -n "$compstate[pattern_match]" &&
      "${orig#\~}" != (|*[^\\])[][*?#~^\|\<\>]* ) ]] && menu=yes
-[[ -n "$_comp_correct" ]] && cfopt=-
+[[ -n "$_comp_correct" ]] && cfopt=- Uopt=-U
 
 # Now let's have a closer look at the string to complete.
 
@@ -612,7 +612,7 @@
 	    # back up the path.
 	    tmp1=("${(@)tmp1%%/*}")
 	    _list_files tmp1 "$prepath$realpath$testpath"
-	    compadd -U -Qf "$mopts[@]" -p "$IPREFIX$linepath$tmp2" \
+	    compadd $Uopt -Qf "$mopts[@]" -p "$IPREFIX$linepath$tmp2" \
 	            -s "/${tmp3#*/}$ISUFFIX" \
 	            -W "$prepath$realpath$testpath" \
 		    "$pfxsfx[@]" \
@@ -622,7 +622,7 @@
 	    # Same with a non-empty suffix
 	    tmp1=("${(@)^tmp1%%/*}/${tmp3#*/}")
 	    _list_files tmp1 "$prepath$realpath$testpath"
-	    compadd -U -Qf "$mopts[@]" -p "$IPREFIX$linepath$tmp2" \
+	    compadd $Uopt -Qf "$mopts[@]" -p "$IPREFIX$linepath$tmp2" \
 	            -s "$ISUFFIX" \
 	            -W "$prepath$realpath$testpath" \
 		    "$pfxsfx[@]" \
@@ -631,7 +631,7 @@
           fi
 	else
 	  _list_files tmp1 "$prepath$realpath$testpath"
-	  compadd -U -Qf "$mopts[@]" -p "$IPREFIX$linepath$tmp2" \
+	  compadd $Uopt -Qf "$mopts[@]" -p "$IPREFIX$linepath$tmp2" \
 	          -s "$ISUFFIX" \
 	          -W "$prepath$realpath$testpath" \
 		   "$pfxsfx[@]" \
@@ -661,7 +661,7 @@
           fi
         else
 	  _list_files tmp1 "$prepath$realpath$testpath"
-	  compadd -U -Qf "$mopts[@]" -p "$IPREFIX$linepath$tmp2" \
+	  compadd $Uopt -Qf "$mopts[@]" -p "$IPREFIX$linepath$tmp2" \
 	          -s "$ISUFFIX" \
                   -W "$prepath$realpath$testpath" \
 		  "$pfxsfx[@]" \
@@ -730,7 +730,7 @@
       compquote tmp4 tmp2 tmp1
       for i in "$tmp1[@]"; do
 	_list_files tmp2 "$prepath$realpath${mid%/*/}"
-        compadd -U -Qf "$mopts[@]" -p "$IPREFIX$linepath$tmp3/" \
+        compadd $Uopt -Qf "$mopts[@]" -p "$IPREFIX$linepath$tmp3/" \
 	        -s "/$tmp4$i$ISUFFIX" \
                 -W "$prepath$realpath${mid%/*/}/" \
 	        "$pfxsfx[@]" $listopts - "$tmp2"
@@ -761,7 +761,7 @@
       else
 	# Not a pattern match
 	_list_files tmp1 "$prepath$realpath$testpath"
-        compadd -U -Qf -p "$IPREFIX$linepath$tmp4" \
+        compadd $Uopt -Qf -p "$IPREFIX$linepath$tmp4" \
 	        -s "$ISUFFIX" \
 	        -W "$prepath$realpath$testpath" \
 	        "$pfxsfx[@]" "$mopts[@]" $listopts -a tmp1



Messages sorted by: Reverse Date, Date, Thread, Author