zsh-workers
 help / color / mirror / code / Atom feed
* _arguments bugs / _typeset (was Re: rsync --progress stops completion)
       [not found]                 ` <CAHYJk3TDimAc6WRoirx_3Lsj9p1CEjH7p=R2oqaoHM0AfJn87w@mail.gmail.com>
@ 2014-09-19  7:15                   ` Bart Schaefer
  0 siblings, 0 replies; only message in thread
From: Bart Schaefer @ 2014-09-19  7:15 UTC (permalink / raw)
  To: zsh-workers

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.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-09-19  7:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <lv9jav$8l6$1@ger.gmane.org>
     [not found] ` <2002755.9ryFYYVtTN@note>
     [not found]   ` <5418786F.8030001@thregr.org>
     [not found]     ` <140916175124.ZM5742@torch.brasslantern.com>
     [not found]       ` <54194198.2010607@thregr.org>
     [not found]         ` <140917085133.ZM6725@torch.brasslantern.com>
     [not found]           ` <541AA918.8060503@thregr.org>
     [not found]             ` <140918093602.ZM7963@torch.brasslantern.com>
     [not found]               ` <140918190130.ZM8366@torch.brasslantern.com>
     [not found]                 ` <CAHYJk3TDimAc6WRoirx_3Lsj9p1CEjH7p=R2oqaoHM0AfJn87w@mail.gmail.com>
2014-09-19  7:15                   ` _arguments bugs / _typeset (was Re: rsync --progress stops completion) Bart Schaefer

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).