From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 953 invoked from network); 8 Mar 2000 16:48:15 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 8 Mar 2000 16:48:15 -0000 Received: (qmail 12327 invoked by alias); 8 Mar 2000 16:47:43 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10009 Received: (qmail 12284 invoked from network); 8 Mar 2000 16:47:42 -0000 From: "Bart Schaefer" Message-Id: <1000308164650.ZM9202@candle.brasslantern.com> Date: Wed, 8 Mar 2000 16:46:50 +0000 In-Reply-To: <38C656A0.B495A8C7@u.genie.co.uk> Comments: In reply to Oliver Kiddle "Problem with completion of array indices" (Mar 8, 1:33pm) References: <38C656A0.B495A8C7@u.genie.co.uk> X-Mailer: Z-Mail (5.0.0 30July97) To: Oliver Kiddle , Zsh workers Subject: PATCH: Re: Problem with completion of array indices MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Mar 8, 1:33pm, Oliver Kiddle wrote: } Subject: Problem with completion of array indices } } This is with an unpatched 3.1.6-dev-19: } } cd $fpath[1 } 1 -- /usr/local/share/zsh/site-functions 10 11 12 13 14 } } So where are the directories corresponding to 10, 11, 12, 13 and 14. As } far as I can tell, it isn't caused by anything in _subscript so it might } be something in compadd. Here's a snippet of xtrace output (I comleted after path because my fpath is not that long): +_subscript:31> zformat -a list -- 1:~/bin 10:/usr/X11R6/bin 11:/bin 12:/usr/bin 13:/usr/rhs/bin 14:/usr/local/bin 15:/usr/X11R6/bin 16:/bin 17:/usr/bin 18:/usr/rhs/bin 19:/usr/local/bin +_subscript:32> disp=( -d list ) +_subscript:37> [[ == ]* ]] +_subscript:40> compadd -V -default- -S ] -d list - 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 The doc for "compadd -d" says there should be one element of the array (`list' in this case) for each word that follows the `-'. Clearly that's not the case here. Index: Completion/Base/_subscript =================================================================== @@ -24,9 +24,12 @@ if zstyle -T ":completion:${curcontext}:indexes" verbose; then list=() for i in "$ind[@]"; do - [[ "$i" = ${PREFIX}*${SUFFIX} ]] && + if [[ "$i" = ${PREFIX}*${SUFFIX} ]]; then list=( "$list[@]" "${i}:$(print -D ${(P)${compstate[parameter]}[$i]})" ) + else + list=( "$list[@]" '' ) + fi done zformat -a list ' -- ' "$list[@]" disp=( -d list) -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com