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

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



Bart Schaefer wrote:

> On Apr 7,  5:16pm, Andy Spiegl wrote:
> } Subject: dev-19 -> 20: special-dirs changed?
> }
> } I've got this:
> }  zstyle ':completion:*:paths' special-dirs yes
> } in my dot files, because I like . and .. to be completed (and / appended),
> } too.  A few days I upgraded from 3.1.6-dev-19 to 3.1.6-dev-20.  Now the
> } behavior has changed.  Hitting TAB after typing "cd .." still works, but
> } after "mv foo .." or "ls .." doesn't.  It also doesn't complete after
> } "cd bar/..".  I supposse something has changed somewhere...
> 
> _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.

_path_files. The test tried to make sure that . and .. are only added
if directories are requested. The patch makes this a bit more clever,
I can't think of a perfect solution.

Bye
 Sven

Index: Completion/Core/_path_files
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_path_files,v
retrieving revision 1.6
diff -u -r1.6 _path_files
--- Completion/Core/_path_files	2000/04/07 08:14:07	1.6
+++ Completion/Core/_path_files	2000/04/10 08:48:04
@@ -293,7 +293,8 @@
       else
         tmp1=( ${^tmp1}${skipped}${^~pats} )
       fi
-      if [[ "$sopt" = *[/f]* && ( -o globdots || "$PREFIX" = .* ) ]] &&
+      if [[ ( "$sopt" = *[/f]* || "$pats" = *\([^[:blank:]]#/[^[:blank:]]#\)* ) &&
+            ( -o globdots || "$PREFIX" = .* ) ]] &&
 	  zstyle -s ":completion:${curcontext}:paths" special-dirs atmp; then
 	if [[ "$atmp" = (yes|true|1|on) ]]; then
 	  tmp1=( "$tmp1[@]" . .. )

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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