Zsh Mailing List Archive
Messages sorted by:
_arguments bugs / _typeset (was Re: rsync --progress stops completion)
- X-seq: zsh-workers 33197
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: _arguments bugs / _typeset (was Re: rsync --progress stops completion)
- Date: Fri, 19 Sep 2014 00:15:25 -0700
- In-reply-to: <CAHYJk3TDimAc6WRoirx_3Lsj9p1CEjH7p=R2oqaoHM0AfJn87w@mail.gmail.com>
- List-help: <mailto:email@example.com>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:firstname.lastname@example.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <email@example.com> <2002755.9ryFYYVtTN@note> <5418786F.firstname.lastname@example.org> <140916175124.ZM5742@torch.brasslantern.com> <email@example.com> <140917085133.ZM6725@torch.brasslantern.com> <541AA918.firstname.lastname@example.org> <140918093602.ZM7963@torch.brasslantern.com> <140918190130.ZM8366@torch.brasslantern.com> <CAHYJk3TDimAc6WRoirx_3Lsj9p1CEjH7p=R2oqaoHM0AfJn87w@mail.gmail.com>
On Sep 19, 5:22am, Mikael Magnusson wrote:
} If we're collecting _arguments bugs here, I noticed yesterday that while
} typeset -<tab>
} correctly completes options, typing something after and then going
} back to the dash to complete, eg
} typeset -<tab> foo is written here
} just inserts a = sign.
Here's the doc for _arguments:
With -A, no options will be completed after the first
non-option argument on the line. The -A must be followed by
a pattern matching all strings which are not to be taken as
arguments. For example, to make _arguments stop completing
options after the first normal argument, but ignoring all
strings starting with a hyphen even if they are not described
by one of the OPTSPECs, the form is `-A "-*"'.
While the statement "ignoring all strings starting with a hyphen" is
strictly correct, in practice you may want '-A "-?##"' or in even
'-A "-[^-]*"' to avoid considering a "-" by itself as an option.
If _typeset is changed to use '-A "-?##"' then 'typeset -<TAB> foo'
works, but I think it works for the wrong reason, two bugs canceling
each other out. What happens is that ca_parse_line() fails to match
'-' with '-?##' and so does not ignore it, which allows it to find
that it might match an option spec. With '-A "-*"' it ignores '-'
and incorrectly goes on to find the "rest of arguments" spec and to
apply that to the current word, even though the current word appears
before the non-option arguments begin.
This is all happening in the block of ca_parse_line() that has the
comment beginning "Bart 2009/11/17:". I suspect the assignment to
state.def is too aggressive, but any obvious fiddling with it breaks
tests in Y03.
Messages sorted by: