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

PATCH: Re: completing directory path



Peter Stephenson wrote:

> completion has stopped working on ~1/... etc.
> 
> % pushd ~1/^D
> 
> works OK but
> 
> % pushd ~1/D^D_main_complete:153: command not found: 1
> _main_complete:153: command not found: 1
> 
> Completing `directory' or `corrections'

Uh oh. _path_files was using tmp=... but didn't declare tmp, only
tmp[1-4], so it set the one from _main_complete.

This should also fix the inserted `+' problem.

Bye
 Sven

Index: Completion/Core/_path_files
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_path_files,v
retrieving revision 1.25
diff -u -r1.25 _path_files
--- Completion/Core/_path_files	2000/07/04 08:07:25	1.25
+++ Completion/Core/_path_files	2000/07/10 08:00:59
@@ -209,21 +209,23 @@
   elif [[ "$linepath" = ([-+]|)[0-9]## ]]; then
     if [[ "$linepath" != [-+]* ]]; then
       if [[ -o pushdminus ]]; then
-        linepath="-$linepath"
+        tmp1="-$linepath"
       else
-        linepath="+$linepath"
+        tmp1="+$linepath"
       fi
+    else
+      tmp1="$linepath"
     fi
     if [[ "$linepath" = -* ]]; then
-      tmp=$(( $#dirstack $linepath ))
+      tmp1=$(( $#dirstack $tmp1 ))
     else
-      tmp=$linepath[2,-1]
+      tmp1=$tmp1[2,-1]
     fi
-    [[ -o pushdminus ]] && tmp=$(( $#dirstack - $tmp ))
-    if (( ! tmp )); then
+    [[ -o pushdminus ]] && tmp1=$(( $#dirstack - $tmp1 ))
+    if (( ! tmp1 )); then
       realpath=$PWD/
-    elif [[ tmp -le $#dirstack ]]; then
-      realpath=$dirstack[tmp]/
+    elif [[ tmp1 -le $#dirstack ]]; then
+      realpath=$dirstack[tmp1]/
     else
       _message 'not enough directory stack entries'
       return 1

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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