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

PATCH: approximation of absolute path in root directory



Dispatches from Maintenance Nightmare Central:

/uzr/bin/em<TAB> -> //uzr/bin/em

even with approximation, which isn't quite what you want (and it happens
with just /uzr, too).  Luckily this one seems to be easy: don't update
the directory-so-far if it's still only /, otherwise this gets added as
an extra path element and becomes the offered completion before we even
get to approximation.

I found this when looking for the problem with approximation of files
beginning with a '.', but that one seems to arise from a lower circle of
Hell ("It Came From Compadd; Only The Compiler Could Stop It").

Index: Completion/Unix/Type/_path_files
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_path_files,v
retrieving revision 1.30
diff -u -r1.30 _path_files
--- Completion/Unix/Type/_path_files	4 Jun 2008 10:12:03 -0000	1.30
+++ Completion/Unix/Type/_path_files	21 Jun 2008 21:26:16 -0000
@@ -414,7 +414,7 @@
       fi
 
       if (( ! $#tmp1 )); then
-        tmp2=( ${^tmp2}/$PREFIX$SUFFIX )
+        tmp2=( ${^${tmp2:#/}}/$PREFIX$SUFFIX )
       elif [[ "$tmp1[1]" = */* ]]; then
         if [[ -n "$_comp_correct" ]]; then
           tmp2=( "$tmp1[@]" )


-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



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