mirror of
git://git.code.sf.net/p/zsh/code
synced 2024-10-02 00:41:44 +02:00
add fake-parameters style to allow completing parameters which are not yet set (12946)
This commit is contained in:
parent
bd4490b966
commit
b9f6bdf162
@ -1,5 +1,11 @@
|
||||
2000-10-10 Sven Wischnowsky <wischnow@zsh.org>
|
||||
|
||||
* 12946: Completion/Base/_math, Completion/Base/_subscript,
|
||||
Completion/Builtins/_vars, Completion/Builtins/_zstyle,
|
||||
Completion/Core/_parameters, Doc/Zsh/compsys.yo: add
|
||||
fake-parameters style to allow completing parameters which are not
|
||||
yet set
|
||||
|
||||
* 12942,12945: Completion/Core/_expand: temporarily remove global
|
||||
aliases to avoid error message inside the evals
|
||||
|
||||
|
@ -9,4 +9,4 @@ if [[ "$SUFFIX" = *[^a-zA-Z0-9_]* ]]; then
|
||||
SUFFIX="${SUFFIX%%[^a-zA-Z0-9_]*}"
|
||||
fi
|
||||
|
||||
_parameters -g '(integer|float)*'
|
||||
_parameters -g '(integer|float)*' || _parameters
|
||||
|
@ -1,6 +1,12 @@
|
||||
#compdef -subscript-
|
||||
|
||||
local expl
|
||||
local expl osuf=']'
|
||||
|
||||
if [[ "$1" = -q ]]; then
|
||||
osuf='] '
|
||||
compquote osuf
|
||||
shift
|
||||
fi
|
||||
|
||||
if [[ "$PREFIX" = :* ]]; then
|
||||
_wanted characters expl 'character class' \
|
||||
@ -9,7 +15,7 @@ if [[ "$PREFIX" = :* ]]; then
|
||||
elif [[ ${(Pt)${compstate[parameter]}} = assoc* ]]; then
|
||||
local suf
|
||||
|
||||
[[ "$RBUFFER" != \]* ]] && suf=']'
|
||||
[[ "$RBUFFER" != (|\\)\]* ]] && suf="$osuf"
|
||||
|
||||
_wanted association-keys expl 'association key' \
|
||||
compadd -S "$suf" -k "$compstate[parameter]"
|
||||
@ -37,12 +43,12 @@ elif [[ ${(Pt)${compstate[parameter]}} = array* ]]; then
|
||||
disp=()
|
||||
fi
|
||||
|
||||
if [[ "$RBUFFER" = \]* ]]; then
|
||||
if [[ "$RBUFFER" = (|\\)\]* ]]; then
|
||||
_all_labels -V indexes expl 'array index' \
|
||||
compadd -S '' "$disp[@]" -a ind && ret=0
|
||||
else
|
||||
_all_labels -V indexes expl 'array index' \
|
||||
compadd -S ']' "$disp[@]" -a ind && ret=0
|
||||
compadd -S "$osuf" "$disp[@]" -a ind && ret=0
|
||||
fi
|
||||
fi
|
||||
_requested parameters && _parameters && ret=0
|
||||
|
Loading…
Reference in New Issue
Block a user