zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: Oliver Kiddle <opk@u.genie.co.uk>,
	Zsh workers <zsh-workers@sunsite.auc.dk>
Subject: PATCH: Re: Problem with completion of array indices
Date: Wed, 8 Mar 2000 16:46:50 +0000	[thread overview]
Message-ID: <1000308164650.ZM9202@candle.brasslantern.com> (raw)
In-Reply-To: <38C656A0.B495A8C7@u.genie.co.uk>

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<tab>
} 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


      reply	other threads:[~2000-03-08 16:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-03-08 13:33 Oliver Kiddle
2000-03-08 16:46 ` Bart Schaefer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1000308164650.ZM9202@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=opk@u.genie.co.uk \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).