From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15045 invoked from network); 9 Mar 1999 10:31:37 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 9 Mar 1999 10:31:37 -0000 Received: (qmail 2423 invoked by alias); 9 Mar 1999 10:31:05 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 5698 Received: (qmail 2415 invoked from network); 9 Mar 1999 10:31:04 -0000 Date: Tue, 9 Mar 1999 11:30:01 +0100 (MET) Message-Id: <199903091030.LAA13527@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: Sven Wischnowsky's message of Tue, 9 Mar 1999 11:12:42 +0100 (MET) Subject: Re: PATCH: small parameter fix I wrote: > The patch at least fixes this. But maybe we should collect opinions > which expression should expand to what and then make the code produce > that. And here is the patch that makes `_long_options' and `_multi_parts' use this... Bye Sven --- oc/User/_long_options Tue Mar 9 09:05:06 1999 +++ Completion/User/_long_options Tue Mar 9 11:03:08 1999 @@ -87,9 +87,9 @@ # option up to the end. Finally all elements with option strings # that contain uppercase letters are removed. - opts=("--${^${${${(M)${(@ps:\n:j:\n:)${(@)${(M)${(@f)$($words[1] --help)}:#[ ]#-*}//,/ + opts=("--${(@)^${(@)${(@)${(@M)${(@ps:\n:j:\n:)${(@)${(@M)${(@f)$("$words[1]" --help)}:#[ ]#-*}//,/ }}:#*--*}#*--}%%[, ]*}:#(*-[A-Z]*|)}") - +echo $#opts # The interpretation of the options is completely table driven. We # use the positional parameters we were given and a few standard # ones. Then we loop through this table. @@ -144,7 +144,7 @@ # an array. tmp=("${(@)tmp:#*\[\=*}") - tmpo=("${${(@)tmpo%%\=*}//[^a-z0-9-]}") + tmpo=("${(@)${(@)tmpo%%\=*}//[^a-z0-9-]}") _lo_cache_actions[anum]="_lo_cache_optarg_$anum $action" eval "_lo_cache_optarg_${anum}=(\"\$tmpo[@]\")" (( anum++ )) @@ -156,7 +156,7 @@ tmpo=("${(@M)tmp:#*\=*}") if (( $#tmpo )); then tmp=("${(@)tmp:#*\=*}") - tmpo=("${${(@)tmpo%%\=*}//[^a-z0-9-]}") + tmpo=("${(@)${(@)tmpo%%\=*}//[^a-z0-9-]}") _lo_cache_actions[anum]="_lo_cache_arg_$anum $action" eval "_lo_cache_arg_${anum}=(\"\$tmpo[@]\")" (( anum++ )) @@ -169,7 +169,7 @@ # Now filter out any option strings we don't like and stuff them # in an array, if there are still some. - tmp=("${${(@)tmp%%\=*}//[^a-z0-9-]}") + tmp=("${(@)${(@)tmp%%\=*}//[^a-z0-9-]}") if (( $#tmp )); then _lo_cache_actions[anum]="$name $action" eval "${name}=(\"\$tmp[@]\")" @@ -215,7 +215,7 @@ for i in "$_lo_cache_actions[@]"; do name="${i%% *}" action="${i#* }" - if (( ${${(@P)name}[(I)$pre]} )); then + if (( ${(@)${(@P)name}[(I)$pre]} )); then if [[ "$action[1]" = (\[|\() ]]; then compadd - ${=action[2,-2]} elif (( $#action )); then diff -u oc/Core/_multi_parts Completion/Core/_multi_parts --- oc/Core/_multi_parts Mon Mar 8 11:05:13 1999 +++ Completion/Core/_multi_parts Tue Mar 9 10:21:02 1999 @@ -85,7 +85,7 @@ tmp1="${orig%%${sep}*}${sep}" pref="$pref$tmp1" - matches=("${${(@)${(@M)matches:#${tmp1}*}#$tmp1}:#}") + matches=("${(@)${(@)${(@M)matches:#${tmp1}*}#$tmp1}:#}") orig="${orig#*${sep}}" patstr="${patstr#*${sep}}" done -- Sven Wischnowsky wischnow@informatik.hu-berlin.de