zsh-workers
 help / color / mirror / code / Atom feed
* Completion behaviour in 4.1.0-dev-1
@ 2001-10-04 16:41 martin.ebourne
  2001-10-05 11:55 ` Sven Wischnowsky
  0 siblings, 1 reply; 2+ messages in thread
From: martin.ebourne @ 2001-10-04 16:41 UTC (permalink / raw)
  To: zsh-workers


Hi,

I've just upgraded from Zsh 4.0.2 to 4.1.0-dev-1, and I've noticed a change
in completion behaviour.

If I do:

% zsh -f
gdd-odybin2% autoload -U compinit
gdd-odybin2% compinit -C
gdd-odybin2% setopt cdablevars
gdd-odybin2% zstyle ':completion:*:complete:cd:*' tag-order local-directories
gdd-odybin2% cd c<TAB>

I get a list of local directories, users, and anything else cd can make use
of. If I do this on 4.0.2 then I only get local directories, assuming one
matches - otherwise I get the other stuff - which is what I want.

In 4.1.0 I get only the local directories if I do 'cd <TAB>', just like in
4.0.2. It's only when I've added the 'c' that it gives the full list.

Cheers,

Martin.




This e-mail message is CONFIDENTIAL and may contain legally privileged
information.  If you are not the intended recipient you should not  read,
copy, distribute, disclose or otherwise use the information in this e-mail.
Please also telephone or fax us immediately and delete the message from
your system.  E-mail may be susceptible to data corruption, interception
and unauthorised amendment, and we do not accept liability for any such
corruption, interception or amendment or the consequences thereof.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Completion behaviour in 4.1.0-dev-1
  2001-10-04 16:41 Completion behaviour in 4.1.0-dev-1 martin.ebourne
@ 2001-10-05 11:55 ` Sven Wischnowsky
  0 siblings, 0 replies; 2+ messages in thread
From: Sven Wischnowsky @ 2001-10-05 11:55 UTC (permalink / raw)
  To: zsh-workers


martin.ebourne@arcordia.com wrote:

> I've just upgraded from Zsh 4.0.2 to 4.1.0-dev-1, and I've noticed a change
> in completion behaviour.
> 
> If I do:
> 
> % zsh -f
> gdd-odybin2% autoload -U compinit
> gdd-odybin2% compinit -C
> gdd-odybin2% setopt cdablevars
> gdd-odybin2% zstyle ':completion:*:complete:cd:*' tag-order local-directories
> gdd-odybin2% cd c<TAB>
> 
> I get a list of local directories, users, and anything else cd can make use
> of. If I do this on 4.0.2 then I only get local directories, assuming one
> matches - otherwise I get the other stuff - which is what I want.
> 
> In 4.1.0 I get only the local directories if I do 'cd <TAB>', just like in
> 4.0.2. It's only when I've added the 'c' that it gives the full list.

Yes, we had some trouble with _cd.  The patch below hopefully makes
this better configurable, using the named-directories tag for anything 
completed by _tilde.

Bye
  Sven

Index: Completion/Zsh/Command/_cd
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Command/_cd,v
retrieving revision 1.4
diff -u -r1.4 _cd
--- Completion/Zsh/Command/_cd	2001/08/22 15:37:19	1.4
+++ Completion/Zsh/Command/_cd	2001/10/05 11:54:17
@@ -32,13 +32,17 @@
   fi
 
   if [[ $PREFIX != (\~|/|./|../)* ]]; then
-    local tmpcdpath
+    local tmpcdpath alt
+
     tmpcdpath=(${${(@)cdpath:#.}:#$PWD})
 
+    (( $#tmpcdpath )) &&
+      alt=( 'path-directories:directory in cdpath:_path_files -W tmpcdpath -/' )
+
     # With cdablevars, we can complete foo as if ~foo/
     if [[ -o cdablevars && -n "$PREFIX" && "$PREFIX" != <-> ]]; then
       if [[ "$PREFIX" != */* ]]; then
-        _tilde && ret=0
+        alt=( "$alt[@]" 'named-directories: : _tilde' )
       else
         local oipre="$IPREFIX" opre="$PREFIX" dirpre dir
 
@@ -51,26 +55,22 @@
         PREFIX="${PREFIX#*/}"
 
         [[ $#dir -eq 1 && "$dir[1]" != "~$dirpre" ]] &&
-          _wanted named-directories expl 'directories after cdablevar' \
+          _wanted named-directories expl 'directory after cdablevar' \
 	      _path_files -W dir -/ && ret=0
 
         PREFIX="$opre"
         IPREFIX="$oipre"
       fi
-    fi
-    if [[ $#tmpcdpath -ne 0 ]]; then
-      # Don't complete local directories in command position, that's
-      # already handled by _command_names (see _autocd)
-      if [[ CURRENT -eq 1 ]]; then
-	_wanted path-directories expl 'directories in cdpath' \
-	  _path_files -W tmpcdpath -/ && ret=0
-      else
-        _alternative \
-	  'local-directories:local directories:_path_files -/' \
-	  "path-directories:directories in cdpath:_path_files -W tmpcdpath -/" && ret=0
-      fi
-      return ret
     fi
+    # Don't complete local directories in command position, that's
+    # already handled by _command_names (see _autocd)
+
+    [[ CURRENT -ne 1 ]] &&
+        alt=( "${cdpath+local-}directories:${cdpath+local }directory:_path_files -/" "$alt[@]" )
+
+    _alternative "$alt[@]" && ret=0
+
+    return ret
   fi
   _wanted directories expl directory _path_files -/ && ret=0
 

-- 
Sven Wischnowsky                    wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-10-05 11:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-04 16:41 Completion behaviour in 4.1.0-dev-1 martin.ebourne
2001-10-05 11:55 ` Sven Wischnowsky

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).