mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-11-01 06:20:55 +01:00
33323: fix bug in removing math functions and complete -M option to functions
This commit is contained in:
parent
8cbff0b82e
commit
00a654af5c
4 changed files with 24 additions and 6 deletions
|
|
@ -1,3 +1,12 @@
|
|||
2014-10-02 Oliver Kiddle <opk@zsh.org>
|
||||
|
||||
* 33323: Completion/Zsh/Command/_typeset, Doc/Zsh/builtins.yo,
|
||||
Src/builtin.c: fix bug in removing math functions and complete
|
||||
-M option to functions
|
||||
|
||||
* 33315: Completion/Unix/Command/_sysctl: fix pattern to
|
||||
match freebsd10 and later
|
||||
|
||||
2014-10-02 Peter Stephenson <p.stephenson@samsung.com>
|
||||
|
||||
* unposted: remove "major".
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#compdef autoload declare export functions integer float local readonly typeset
|
||||
|
||||
local expl state line func i use curcontext="$curcontext"
|
||||
local fopts="-f -k -z"
|
||||
local fopts="-f -k -z +k +z"
|
||||
local popts="-A -E -F -L -R -T -Z -a -g -h -H -i -l -r -x"
|
||||
local -A allargs opt_args
|
||||
local -a args
|
||||
|
|
@ -51,8 +51,9 @@ case ${service} in
|
|||
;;
|
||||
float) use="EFHghlprtux";;
|
||||
functions)
|
||||
use="UkmTtuz"
|
||||
use="UkmTtuzM"
|
||||
func=f
|
||||
allargs[M]='(-k -t -T -u -U -z -M +M +k +t +z)-+M[define mathematical function]'
|
||||
;;
|
||||
integer)
|
||||
use="Hghilprtux"
|
||||
|
|
@ -73,14 +74,20 @@ onopts=${(j..)${${words[1,CURRENT-1]:#^-*}##-}}
|
|||
offopts=${(j..)${${words[1,CURRENT-1]:#^+*}##+}}
|
||||
|
||||
for ((i=1;i<=$#use;++i)); do
|
||||
args+=( ${allargs[${use[$i]}${${(s::)use[$i]}[(r)[Uut]]:+$func}]} )
|
||||
args+=( ${allargs[${use[$i]}${${(s::)use[$i]}[(r)[UutT]]:+$func}]} )
|
||||
done
|
||||
|
||||
_arguments -C -s -A "-*" -S "${args[@]}" '*::vars:= ->vars_eq'
|
||||
|
||||
if [[ "$state" = vars_eq ]]; then
|
||||
if [[ $func = f ]]; then
|
||||
if (( $+opt_args[-w] ));then
|
||||
if (( $+opt_args[+M] || ( $+opt_args[-M] && $+opt_args[-m] ) )); then
|
||||
_wanted functions expl 'math function' compadd -F line - \
|
||||
${${${(f)"$(functions -M)"}##*-M }%% *}
|
||||
elif (( $+opt_args[-M] )); then
|
||||
_arguments ':new math function:_functions' ':minimum arguments' \
|
||||
':maximum arguments' ':shell function:_functions'
|
||||
elif (( $+opt_args[-w] )); then
|
||||
_wanted files expl 'zwc file' _files -g '*.zwc(-.)'
|
||||
elif [[ $service = autoload || -n $opt_args[(i)-[uU]] ]]; then
|
||||
args=(${^fpath}/*(-.:t))
|
||||
|
|
|
|||
|
|
@ -773,7 +773,7 @@ findex(functions)
|
|||
xitem(tt(functions) [ {tt(PLUS())|tt(-)}tt(UXkmtTuz) ] [ var(name) ... ])
|
||||
xitem(tt(functions -M) var(mathfn) [ var(min) [ var(max) [ var(shellfn) ] ] ])
|
||||
xitem(tt(functions -M) [ tt(-m) var(pattern) ... ])
|
||||
item(tt(functions +M) [ tt(-m) ] var(mathfn))(
|
||||
item(tt(functions +M) [ tt(-m) ] var(mathfn) ... )(
|
||||
Equivalent to tt(typeset -f), with the exception of the tt(-M) option.
|
||||
Use of the tt(-M) option may not be combined with any of the options
|
||||
handled by tt(typeset -f).
|
||||
|
|
|
|||
|
|
@ -2759,7 +2759,7 @@ bin_functions(char *name, char **argv, Options ops, int func)
|
|||
tokenize(*argv);
|
||||
if ((pprog = patcompile(*argv, PAT_STATIC, 0))) {
|
||||
queue_signals();
|
||||
for (p = mathfuncs, q = NULL; p; q = p, p = p->next) {
|
||||
for (p = mathfuncs, q = NULL; p; q = p) {
|
||||
MathFunc next;
|
||||
do {
|
||||
next = NULL;
|
||||
|
|
@ -2774,6 +2774,8 @@ bin_functions(char *name, char **argv, Options ops, int func)
|
|||
}
|
||||
/* if we deleted one, retry with the new p */
|
||||
} while (next);
|
||||
if (p)
|
||||
p = p->next;
|
||||
}
|
||||
unqueue_signals();
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue