diff options
-rw-r--r-- | Completion/Base/_arguments | 6 | ||||
-rw-r--r-- | Completion/Base/_values | 6 | ||||
-rw-r--r-- | Completion/Linux/_rpm | 2 | ||||
-rw-r--r-- | Completion/User/_flex | 2 | ||||
-rw-r--r-- | Completion/User/_gcc | 2 | ||||
-rw-r--r-- | Completion/User/_gprof | 2 | ||||
-rw-r--r-- | Completion/User/_gs | 2 | ||||
-rw-r--r-- | Completion/User/_lynx | 2 | ||||
-rw-r--r-- | Completion/User/_mount | 12 | ||||
-rw-r--r-- | Completion/User/_netscape | 6 | ||||
-rw-r--r-- | Completion/User/_nslookup | 4 | ||||
-rw-r--r-- | Completion/User/_rlogin | 6 | ||||
-rw-r--r-- | Completion/User/_socket | 6 | ||||
-rw-r--r-- | Completion/User/_ssh | 6 | ||||
-rw-r--r-- | Completion/User/_telnet | 6 | ||||
-rw-r--r-- | Completion/User/_urls | 9 | ||||
-rw-r--r-- | Completion/User/_wget | 2 | ||||
-rw-r--r-- | Completion/User/_yp | 4 | ||||
-rw-r--r-- | Completion/X/_xmodmap | 2 | ||||
-rw-r--r-- | Doc/Zsh/compsys.yo | 8 | ||||
-rw-r--r-- | Src/Zle/computil.c | 4 | ||||
-rw-r--r-- | Src/Zle/zle_tricky.c | 1 | ||||
-rw-r--r-- | Src/utils.c | 6 |
23 files changed, 58 insertions, 48 deletions
diff --git a/Completion/Base/_arguments b/Completion/Base/_arguments index 9875d979b..f7a20ee96 100644 --- a/Completion/Base/_arguments +++ b/Completion/Base/_arguments @@ -171,18 +171,18 @@ if comparguments -i "$compconfig[autodescribe_options]" "$@"; then _description expl "$descr" if [[ "$action" = -\>* ]]; then - comparguments -W line options + comparguments -W line opt_args state="${${action[3,-1]##[ ]#}%%[ ]#}" compstate[restore]='' aret=yes else if [[ -z "$local" ]]; then local line - typeset -A options + typeset -A opt_args local=yes fi - comparguments -W line options + comparguments -W line opt_args if [[ "$action" = \ # ]]; then diff --git a/Completion/Base/_values b/Completion/Base/_values index aff2f92d8..549c71ff8 100644 --- a/Completion/Base/_values +++ b/Completion/Base/_values @@ -59,14 +59,14 @@ if compvalues -i "$@"; then expl=( "-qS$sep" "$expl[@]" ) if [[ "$action" = -\>* ]]; then - compvalues -v values + compvalues -v val_args state="${${action[3,-1]##[ ]#}%%[ ]#}" compstate[restore]='' return 1 else - typeset -A values + typeset -A val_args - compvalues -v values + compvalues -v val_args if [[ "$action" = \ # ]]; then diff --git a/Completion/Linux/_rpm b/Completion/Linux/_rpm index 70de704d0..a09d16587 100644 --- a/Completion/Linux/_rpm +++ b/Completion/Linux/_rpm @@ -44,7 +44,7 @@ local ret=1 tmp expl # Used by `_arguments', made local here. local state lstate line -typeset -A options +typeset -A opt_args state='' diff --git a/Completion/User/_flex b/Completion/User/_flex index c63d0d2da..ef998c3cf 100644 --- a/Completion/User/_flex +++ b/Completion/User/_flex @@ -1,7 +1,7 @@ #compdef flex local state line ret=1 -typeset -A options +typeset -A opt_args _arguments -s \ --help --version \ diff --git a/Completion/User/_gcc b/Completion/User/_gcc index bf92efdc2..2fa29df8c 100644 --- a/Completion/User/_gcc +++ b/Completion/User/_gcc @@ -1,7 +1,7 @@ #compdef gcc local state line ret=1 expl args -typeset -A options +typeset -A opt_args args=() case $MACHTYPE in diff --git a/Completion/User/_gprof b/Completion/User/_gprof index aec50e0d6..211a7a15f 100644 --- a/Completion/User/_gprof +++ b/Completion/User/_gprof @@ -1,7 +1,7 @@ #compdef gprof local state line ret=1 -typeset -A options +typeset -A opt_args _arguments -s -{a,b,c,D,h,i,l,L,s,T,v,w,x,y,z} \ -{A,C,e,E,f,F,J,n,N,O,p,P,q,Q,Z}:'function name:->funcs' \ diff --git a/Completion/User/_gs b/Completion/User/_gs index 7e86981e9..55dc4f8f7 100644 --- a/Completion/User/_gs +++ b/Completion/User/_gs @@ -9,7 +9,7 @@ if compset -N --; then fi else local state line ret=1 - typeset -A options + typeset -A opt_args _x_arguments \ '-q[quiet startup]' \ diff --git a/Completion/User/_lynx b/Completion/User/_lynx index 2c6b48f92..eaf5a6603 100644 --- a/Completion/User/_lynx +++ b/Completion/User/_lynx @@ -1,7 +1,7 @@ #compdef lynx local state line -typeset -A options +typeset -A opt_args _arguments \ '-accept_all_cookies' \ diff --git a/Completion/User/_mount b/Completion/User/_mount index 40bc3b4ea..579f24381 100644 --- a/Completion/User/_mount +++ b/Completion/User/_mount @@ -6,7 +6,7 @@ # are below these table. local state line ret=1 args fss deffs=iso9660 descr tmp -typeset -A options +typeset -A opt_args if (( ! $+_fs_any )); then @@ -233,30 +233,30 @@ fstype) compadd "$expl[@]" -qS, -M 'L:|no=' - "$fss[@]" && ret=0 ;; fsopt) - eval 'tmp=(' '"$_fs_'${(s:,:)^${options[-t]:-${deffs}}}'[@]"' ')' + eval 'tmp=(' '"$_fs_'${(s:,:)^${opt_args[-t]:-${deffs}}}'[@]"' ')' tmp=( "$_fs_any[@]" "${(@)tmp:#}" ) _values -s , 'file system options' "$tmp[@]" && ret=0 ;; devordir) - if (( $+options[-a] )); then + if (( $+opt_args[-a] )); then _message "no device or directory with option \`-a'" else _description expl device compadd "$expl[@]" /dev/* && ret=0 - if (( ! $+options[-t] )); then + if (( ! $+opt_args[-t] )); then _description expl 'mount point' _files "$expl[@]" -/ && ret=0 fi fi ;; udevordir) - if (( $+options[-a] )); then + if (( $+opt_args[-a] )); then _message "no device or directory with option \`-a'" else tmp=( "${(@f)$(< /etc/mtab)}" ) _description expl device compadd "$expl[@]" - "${(@)${(@)tmp%% *}:#none}" && ret=0 - if (( ! $+options[-t] )); then + if (( ! $+opt_args[-t] )); then _description expl 'mount point' compadd "$expl[@]" - "${(@)${(@)tmp#* }%% *}" fi diff --git a/Completion/User/_netscape b/Completion/User/_netscape index f176083d2..11f583dd5 100644 --- a/Completion/User/_netscape +++ b/Completion/User/_netscape @@ -1,6 +1,7 @@ #compdef netscape -local state +local state line +typeset -A opt_args _x_arguments \ '-xrm:resource:_x_resource' \ @@ -69,7 +70,8 @@ if [ "$state" = "urls" ]; then compadd authors blank cache document fonts global hype image-cache \ license logo memory-cache mozilla plugins else - compadd -S '' about: mocha: javascript: + _description expl 'URL prefix' + compadd "$expl[@]" -S '' about: mocha: javascript: _urls "$@" fi fi diff --git a/Completion/User/_nslookup b/Completion/User/_nslookup index 7d2a12142..6b2585f3d 100644 --- a/Completion/User/_nslookup +++ b/Completion/User/_nslookup @@ -113,7 +113,7 @@ if [[ -n "$compcontext" ]]; then return ;; set) - typeset -A values + typeset -A val_args _values 'state information' "$setopts[@]" && ret=0 @@ -130,7 +130,7 @@ fi if [[ -z "$state" ]]; then local line - typeset -A options + typeset -A opt_args _arguments \ "-${(@)^${(@M)setopts:#*\]:*}/\[/=[}" \ diff --git a/Completion/User/_rlogin b/Completion/User/_rlogin index 825786d80..aa66b8f01 100644 --- a/Completion/User/_rlogin +++ b/Completion/User/_rlogin @@ -21,7 +21,7 @@ _rlogin () { ;; rsh|remsh) local state line ret=1 - typeset -A options + typeset -A opt_args _arguments -s \ '-n[ignore stdin]' \ @@ -39,7 +39,7 @@ _rlogin () { ;; rcp) local state line ret=1 - typeset -A options + typeset -A opt_args _arguments -s \ '-p[preserve modification times]' \ @@ -71,7 +71,7 @@ _rlogin_hosts () { _combination accounts_users_hosts "users=${IPREFIX/@}" hosts "$@" else _combination accounts_users_hosts \ - ${options[-l]:+"users=${options[-l]:q}"} hosts "$@" + ${opt_args[-l]:+"users=${opt_args[-l]:q}"} hosts "$@" fi } diff --git a/Completion/User/_socket b/Completion/User/_socket index 9b1caab73..e43c14c24 100644 --- a/Completion/User/_socket +++ b/Completion/User/_socket @@ -6,7 +6,7 @@ # The array that contains paris `host:port'. local state line expl -typeset -A options +typeset -A opt_args if [[ $CURRENT -eq 2 && ( -z "$compconfig[option_prefix]" || @@ -41,7 +41,7 @@ command) ;; arg1) - if (( $+options[-s] )); then + if (( $+opt_args[-s] )); then _description expl 'port to listen' _ports "$expl[@]" else @@ -51,7 +51,7 @@ arg1) ;; arg2) - if (( ! $+options[-s] )); then + if (( ! $+opt_args[-s] )); then _description expl 'port to connect' _combination socket_hosts_ports hosts="${line[2]:q}" ports "$expl[@]" fi diff --git a/Completion/User/_ssh b/Completion/User/_ssh index 21ddcdcba..952b99193 100644 --- a/Completion/User/_ssh +++ b/Completion/User/_ssh @@ -2,7 +2,7 @@ _ssh () { local state lstate line ret=1 expl args - typeset -A options + typeset -A opt_args local accounts_users_hosts @@ -143,7 +143,7 @@ _ssh () { else _description expl 'remote host name' _ssh_hosts "$expl[@]" && ret=0 - if (( ! $+options[-l] )); then + if (( ! $+opt_args[-l] )); then _description expl 'login name' _ssh_users "$expl[@]" -S@ -q && ret=0 fi @@ -230,7 +230,7 @@ _ssh_hosts () { _combination accounts_users_hosts "users=${IPREFIX/@}" hosts "$@" else _combination accounts_users_hosts \ - ${options[-l]:+"users=${options[-l]:q}"} hosts "$@" + ${opt_args[-l]:+"users=${opt_args[-l]:q}"} hosts "$@" fi } diff --git a/Completion/User/_telnet b/Completion/User/_telnet index 2895cc2af..b1c628d11 100644 --- a/Completion/User/_telnet +++ b/Completion/User/_telnet @@ -6,7 +6,7 @@ # The array that contains 3-tuples `host:port:user'. local state line expl -typeset -A options +typeset -A opt_args if (( ! $+_telnet_short )); then local k help="$(telnet -\? < /dev/null 2>&1)" @@ -69,14 +69,14 @@ case "$state" in hosts) _description expl 'host' _combination telnet_hosts_ports_users \ - ${options[-l]:+users=${options[-l]:q}} \ + ${opt_args[-l]:+users=${opt_args[-l]:q}} \ hosts "$expl[@]" ;; ports) _description expl 'port' _combination telnet_hosts_ports_users \ - ${options[-l]:+users=${options[-l]:q}} \ + ${opt_args[-l]:+users=${opt_args[-l]:q}} \ hosts="${line[2]:q}" \ ports "$expl[@]" ;; diff --git a/Completion/User/_urls b/Completion/User/_urls index 04fe934e7..c5cd41bf6 100644 --- a/Completion/User/_urls +++ b/Completion/User/_urls @@ -37,7 +37,7 @@ # name used by a user placing web pages within their home area. # e.g. compconf urls_localhttp=www:/usr/local/apache/htdocs:public_html -local ipre scheme host user dirs files ret=1 +local ipre scheme host user dirs files ret=1 expl if [[ "$1" = -f ]]; then shift @@ -54,9 +54,10 @@ if [[ -prefix [-+.a-z0-9]#: ]]; then scheme="${PREFIX%%:*}" compset -P "[-+.a-z0-9]#:" else - [ -d $compconfig[urls_path]/bookmark ] && - compadd "$@" -S '' bookmark: && ret=0 - compadd "$@" -S '' file: ftp:// gopher:// http:// && ret=0 + _description expl 'URL prefix' + [[ -d $compconfig[urls_path]/bookmark ]] && + compadd "$@" "$expl[@]" -S '' bookmark: && ret=0 + compadd "$@" "$expl[@]" -S '' file: ftp:// gopher:// http:// && ret=0 return $ret fi diff --git a/Completion/User/_wget b/Completion/User/_wget index e53e32888..c9b671194 100644 --- a/Completion/User/_wget +++ b/Completion/User/_wget @@ -1,7 +1,7 @@ #compdef wget local state line -typeset -A options +typeset -A opt_args local tmp1 tmp2 diff --git a/Completion/User/_yp b/Completion/User/_yp index bf8090b6a..e06f42a29 100644 --- a/Completion/User/_yp +++ b/Completion/User/_yp @@ -1,7 +1,7 @@ #compdef ypcat ypmatch yppasswd ypwhich ypset ypserv ypbind yppush yppoll ypxfr domainname local line state ret=1 -typeset -A options +typeset -A opt_args if (( ! $+_yp_cache_maps )); then _yp_cache_maps=( "${(@)${(@f)$(ypwhich -m)}%% *}" ) @@ -93,7 +93,7 @@ if [[ "$state" = map* ]]; then compadd "$expl[@]" -M 'l:.|by=by l:.|=by r:|.=* r:|=*' - \ "$_yp_cache_maps[@]" && ret=0 - if [[ $+options[-t] -eq 0 && "$state" != maponly ]]; then + if [[ $+opt_args[-t] -eq 0 && "$state" != maponly ]]; then _description expl 'nicknames' compadd "$expl[@]" - "$_yp_cache_nicks[@]" && ret=0 fi diff --git a/Completion/X/_xmodmap b/Completion/X/_xmodmap index 0f6514eb6..29e584623 100644 --- a/Completion/X/_xmodmap +++ b/Completion/X/_xmodmap @@ -3,7 +3,7 @@ setopt localoptions extendedglob local state line ret=1 -typeset -A options +typeset -A opt_args _x_arguments \ -{help,grammar,verbose,quiet} \ diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo index 1cd61a22f..370585863 100644 --- a/Doc/Zsh/compsys.yo +++ b/Doc/Zsh/compsys.yo @@ -863,7 +863,7 @@ that implement a state machine. In this case, the `var(string)' (with all leading and trailing spaces and tabs removed) will be stored in the global parameter tt(state) and the function returns with a return value of 300 (to make it distinguishable from other return values) -after setting the global `tt(line)' and `tt(options)' +after setting the global `tt(line)' and `tt(opt_args)' parameters as described below and without resetting any changes made to the special parameters such as tt(PREFIX) and tt(words). @@ -894,7 +894,7 @@ During the evaluation or execution of the action the array `tt(line)' will be set to the command name and normal arguments from the command line, i.e. to the words from the command line excluding all options and their arguments. These are stored in the associative array -`tt(options)', using the option names as keys and their arguments as +`tt(opt_args)', using the option names as keys and their arguments as the values. For options that have more than one argument these are given as one string, separated by colons. All colons in the original arguments are preceded with backslashes. @@ -1044,6 +1044,10 @@ To decide if the descriptions for the values (not those for the arguments) should be printed, the configuration key tt(describe_values) is used in the same way as the key tt(describe_options) is used by the tt(_arguments) function. + +One last difference is that this function uses the associative array +tt(val_args) to report values and their arguments (but otherwise this +is the same as the tt(opt_args) association used by tt(_arguments)). ) item(tt(_regex_arguments))( This function is a compiler to generate a completion function. The diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c index aed3d9808..e1ce68865 100644 --- a/Src/Zle/computil.c +++ b/Src/Zle/computil.c @@ -812,8 +812,8 @@ ca_get_opt(Cadef d, char *line, int full, char **end) return p; } else { for (p = d->opts; p; p = p->next) - if (p->active && p->args && p->type != CAO_NEXT && - strpfx(p->name, line)) { + if (p->active && ((!p->args || p->type == CAO_NEXT) ? + !strcmp(p->name, line) : strpfx(p->name, line))) { if (end) { int l = strlen(p->name); diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c index ebae044b9..be671ab50 100644 --- a/Src/Zle/zle_tricky.c +++ b/Src/Zle/zle_tricky.c @@ -5452,6 +5452,7 @@ set_comp_sep(void) if (compisuffix) s = dyncat(s, compisuffix); + untokenize(s); return sep_comp_string("", s, lip + lp, 0); } diff --git a/Src/utils.c b/Src/utils.c index 140d00d32..1162968fd 100644 --- a/Src/utils.c +++ b/Src/utils.c @@ -91,8 +91,10 @@ zwarnnam(const char *cmd, const char *fmt, const char *str, int num) nicezputs(scriptname ? scriptname : argzero, stderr); fputs(": ", stderr); } - nicezputs(cmd, stderr); - fputs(": ", stderr); + if (cmd) { + nicezputs(cmd, stderr); + fputs(": ", stderr); + } zerrmsg(fmt, str, num); } |