1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-16 12:21:18 +02:00

make _cd use only one call to _alternative, including completions from _tilde (using the named-directories tag) (15945)

This commit is contained in:
Sven Wischnowsky 2001-10-05 11:56:56 +00:00
parent 22d506ed6b
commit 4bf4818f5a
2 changed files with 20 additions and 16 deletions

View file

@ -1,5 +1,9 @@
2001-10-05 Sven Wischnowsky <wischnow@zsh.org>
* 15945: Completion/Zsh/Command/_cd: make _cd use only one call
to _alternative, including completions from _tilde (using the
named-directories tag)
* 15944: Completion/Unix/Type/_path_files, Doc/Zsh/compsys.yo:
make expand style (file completion) work again; no more special
behaviour with menu completion; try to make docs clearer

View file

@ -32,13 +32,17 @@ else
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 @@ else
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