From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18500 invoked from network); 27 Dec 2005 00:22:37 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00, FORGED_RCVD_HELO autolearn=ham version=3.1.0 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 27 Dec 2005 00:22:37 -0000 Received: (qmail 179 invoked from network); 27 Dec 2005 00:22:30 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 27 Dec 2005 00:22:30 -0000 Received: (qmail 1755 invoked by alias); 27 Dec 2005 00:22:27 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 22108 Received: (qmail 1746 invoked from network); 27 Dec 2005 00:22:27 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 27 Dec 2005 00:22:27 -0000 Received: (qmail 99770 invoked from network); 27 Dec 2005 00:22:27 -0000 Received: from vms048pub.verizon.net (206.46.252.48) by a.mx.sunsite.dk with SMTP; 27 Dec 2005 00:22:25 -0000 Received: from candle.brasslantern.com ([71.116.81.225]) by vms048.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPA id <0IS400GH1RPBWPH1@vms048.mailsrvcs.net> for zsh-workers@sunsite.dk; Mon, 26 Dec 2005 18:22:24 -0600 (CST) Received: from candle.brasslantern.com (IDENT:schaefer@localhost [127.0.0.1]) by candle.brasslantern.com (8.12.11/8.12.11) with ESMTP id jBR0MGMB030958 for ; Mon, 26 Dec 2005 16:22:21 -0800 Received: (from schaefer@localhost) by candle.brasslantern.com (8.12.11/8.12.11/Submit) id jBR0MBeN030957 for zsh-workers@sunsite.dk; Mon, 26 Dec 2005 16:22:11 -0800 Date: Tue, 27 Dec 2005 00:22:10 +0000 From: Bart Schaefer Subject: Strange menu selection with _arguments and matcher-list To: zsh-workers@sunsite.dk Message-id: <1051227002210.ZM30956@candle.brasslantern.com> MIME-version: 1.0 X-Mailer: Z-Mail (5.0.0 30July97) Content-type: text/plain; charset=us-ascii I'm working on improving _su, mainly so that it'll call _normal on the argument of the -c flag, the way _sh does. I've got what I think is a fairly straightforward _arguments call, but I get some very strange behavior from menu selection. Here's a relatively small test case; I haven't tried all possible smaller cases, but it does at least appear to require multiple options that go to the same state plus the wildcard "non-option arguments" pattern and the "matcher-list" completion style. Affects 4.2.5 and later, so it's not a multi-byte thing, but not 4.0.x. ---------- _foo () { local -A opt_args local -a args state context local line args=( '(--command)-c[pass command to shell]:command string:->command' '(-c)--command=-[pass command to shell]:command string:->command' '-f[pass -f to shell (csh)]' '(--login)-l[use a login shell]' '(-l)--login[use a login shell]' '(-p --preserve-environment)-m[do not reset environment]' '(-m --preserve-environment)-p[do not reset environment]' '(-m -p)--preserve-environment[do not reset environment]' '(--shell)-s[run the specified shell]:shell:->shell' '(-s)--shell=-[run the specified shell]:shell:->shell' '*:arguments:->rest' ) _arguments -R $args[@] || case $state in (command) compset -q _normal ;; (shell) compadd ${(f)^"$( and watch strange things happen: ++++++++++ schaefer<529> foo anything --command= --command --login --preserve-environment --shell -f -c -l -p -s -m -- pass command to shell -- use a login shell -- do not reset environment -- run the specified shell -- pass -f to shell (csh) --command --login --preserve-environment ++++++++++