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

Patch (?) for _path_files



I believe this has to do with the thread "Re: Another _path_files bug?"
from the first couple of weeks of February 2011.

--- ../zsh-forge/current/Completion/Unix/Type/_path_files       2011-02-13 10:44
:16 -0800
+++ ./Completion/Unix/Type/_path_files  2011-02-13 10:51:33 -0800
@@ -751,10 +751,11 @@
       [[ "$tsuf" != /* ]] && mid="$testpath"
       if [[ -z "$_comp_correct" && -n "$compstate[pattern_match]" &&
             "$tmp2" = (|*[^\\])[][*?#~^\|\<\>]* ]]; then
-        cpre="${cpre}${tmp1[1]%%/*}/"
+        cpre="${cpre}${tmp1[1]%%/*}"
       else
-        cpre="${cpre}${tpre}/"
+        cpre="${cpre}${tpre}"
       fi
+      [[ "$tsuf" = /* ]] && cpre+=/
       tpre="${tsuf#*/}"
       tsuf=
     else

I backed out most of my scratch work from that thread when PWS posted
workers/28750, but kept this bit -- for reasons that sadly I now no
longer remember.  It avoids appending a slash to the common prefix (if
I recall correctly what cpre means, which I may not) unless there was
a leading slash on the tested suffix (again IIRC tsuf).  I suspect
this was meant to prevent double slash appearing in some completions.

Any opinions on whether this is correct/useful?



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