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

PATCH: Re: dev-19 -> 20: special-dirs changed?



[ moved to zsh-workers ]

Andy Spiegl wrote:

> Bart Schaefer wrote:
> > _path_files now recognizes special-dirs only when one of -f or -/ is used.
> > The doc says that -f means "complete all files."  However, _files always
> > calls `_path_files -g ...' so there's no way to get special-dirs to be
> > recognized for default file completions.
> > 
> > This is presumably a bug, but whether it's a bug in _path_files or _files
> > I don't know.
> 
> Hm, haven't heard anything about this issue since.  Did it make it onto
> the bug list?  I still find it pretty annoying that completion doesn't
> work in these cases. :-(
> 
> I investigated a little more:
> Here are cases where no slash is appended after hitting TAB:
> cd bar/..
> mv foo ..
> mv foo ../bar/..
> ls ..
> ls ../bar/..

Oops, indeed. Seems like I forgot to fix that, sorry.

Bye
 Sven

Index: Completion/Core/_path_files
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_path_files,v
retrieving revision 1.14
diff -u -r1.14 _path_files
--- Completion/Core/_path_files	2000/05/16 11:24:55	1.14
+++ Completion/Core/_path_files	2000/05/25 11:59:42
@@ -142,6 +142,9 @@
 zstyle -s ":completion:${curcontext}:paths" special-dirs sdirs &&
     [[ "$sdirs" = (yes|true|on|1) ]] && sdirs=yes
 
+[[ "$pats" = ((|*[[:blank:]])\*(|[[:blank:]]*)|*\([^[:blank:]]#/[^[:blank:]]#\)*) ]] &&
+    sopt=$sopt/
+
 zstyle -s ":completion:${curcontext}:files" ignore-parents ignpar
 
 # We get the prefix and the suffix from the line and save the whole
@@ -293,9 +296,9 @@
       fi
       if [[ -n "$sdirs" && ( -o globdots || "$PREFIX" = .* ) ]]; then
 	if [[ "$sdirs" = yes ]]; then
-	  tmp1=( "$tmp1[@]" . .. )
+	  tmp1=( "$tmp1[@]" $^tmp2${skipped}{.,..} )
 	elif [[ "$sdirs" = .. ]]; then
-	  tmp1=( "$tmp1[@]" .. )
+	  tmp1=( "$tmp1[@]" $^tmp2${skipped}.. )
         fi
       fi
     else
@@ -304,13 +307,12 @@
       else
         tmp1=( ${^tmp1}${skipped}${^~pats} )
       fi
-      if [[ -n "$sdirs" &&
-            ( "$sopt" = *[/f]* || "$pats" = *\([^[:blank:]]#/[^[:blank:]]#\)* ) &&
+      if [[ -n "$sdirs" && "$sopt" = *[/f]* &&
             ( -o globdots || "$PREFIX" = .* ) ]]; then
 	if [[ "$sdirs" = yes ]]; then
-	  tmp1=( "$tmp1[@]" . .. )
+	  tmp1=( "$tmp1[@]" $^tmp2${skipped}{.,..} )
 	elif [[ "$sdirs" = .. ]]; then
-	  tmp1=( "$tmp1[@]" .. )
+	  tmp1=( "$tmp1[@]" $^tmp2${skipped}.. )
         fi
       fi
     fi

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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