From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14894 invoked by alias); 3 Feb 2015 12:02:56 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 34456 Received: (qmail 5751 invoked from network); 3 Feb 2015 12:02:53 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-Biglobe-Sender: Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: zsh - dose not use menu completion From: "Jun T." In-Reply-To: <150202091539.ZM31856@torch.brasslantern.com> Date: Tue, 3 Feb 2015 21:02:46 +0900 Content-Transfer-Encoding: quoted-printable Message-Id: <938758E6-3401-4C35-931D-670E42774A7B@kba.biglobe.ne.jp> References: <150202091539.ZM31856@torch.brasslantern.com> To: zsh-workers@zsh.org X-Mailer: Apple Mail (2.1878.6) X-Biglobe-Spnum: 54494 I put the following line (/dev/ttys003 is a tty on which I monitor) echo '<'$argv'>' >/dev/ttys003 at line 292 of _arguments. When "_arguments -S -s --" is called, the initial part of the output to /dev/ttys003 is <-S> <-s> <--help[show this message, then exit]> ... while the output from "_arugments -S -s -- '*:'" looks like <-S> <-s> <--help[show this message, then exit]:> ... <:> ... i.e., a ':' is added to the end of each element of $argv. I believe this is not a problem, but there is an element which consists of a single : alone. I guess this ':' is later interpreted as the argument-1. I put a few more echo into _arguments to see where this <:> comes from, and found that the problem is at line 29 of _arguments: typeset -U lopts This initialize lopts as a scalar (empty string), not as an empty array. When lopts is later converted to an array by lopts+=3D( new_element ) the original scalar value (empty string) remains as the 1st element. For example, $ typeset -U u $ u+=3D( one ) $ echo '<'$u'>' <> If '*:' is passed to "_arguments --" this empty element becomes ':' in $argv somewhere. Replacing -U by -Ua seems to fix the problem (see the patch below), but:=20 2015/02/03 02:15, Bart Schaefer wrote: > The special case of `*:' means both > MESSAGE and ACTION are empty, which has the effect of causing > options having no description in the help output to be ordered in > listings ahead of options that have a description. I can't reproduce this behavior. If the sort style is on (default?) then the options with description are always listed first, while if the sort style is off then the options without description are listed first, irrespective of whether '*:' is passed to "_argument --" or not (by modifying the line 27 of _sh). diff --git a/Completion/Base/Utility/_arguments = b/Completion/Base/Utility/_arguments index d70c442..1f35e8d 100644 --- a/Completion/Base/Utility/_arguments +++ b/Completion/Base/Utility/_arguments @@ -26,7 +26,7 @@ if (( long )); then =20 if (( ! ${(P)+name} )); then local iopts sopts pattern tmpo dir cur cache - typeset -U lopts + typeset -Ua lopts =20 cache=3D() =20