From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: [PATCH] handle options of _arguments correctly
Date: Mon, 28 Sep 2015 16:48:55 -0700 [thread overview]
Message-ID: <150928164855.ZM29167@torch.brasslantern.com> (raw)
In-Reply-To: <DBF4507F-647B-4DE3-BCD9-CE194BA1BA41@kba.biglobe.ne.jp>
On Sep 29, 1:55am, Jun T. wrote:
}
} This is because, at line 18 of _arguments, $tmpargv is set to '-s',
} which is used at line 144 to remove -s from $lopts; i.e., -s is
} considered as an optspec, not an option to _arguments itself.
} A simple fix would be to move the while loop (lines 295-306) to the top
} of _arguments.
}
} This leads to the following patch. Are there any unexpected side
} effects of this?
I don't see anything immediate (though this renders the name "singsub"
for the array somewhat nonsensical).
The stuff on line 144 came from this change:
+2000-08-02 Sven Wischnowsky <wischnow@zsh.org>
+
+ * 12475: Completion/Base/_arguments: prefer user-defined specs
+ over ones derived from --help output
+
I'm guessing that code should have looked for a ":" in $tmpargv and only
treat as specs, those positions that follow either the ":" or that follow
any option letter that can't appear to the left of a ":". I haven't run
it down to this level, but it's possible that code pre-dates _arguments
having any switches of its own.
E.g.
_arguments -s -w -q -s --
and
_arguments -s -w : -q -s --
are equivalent becaue of the -q (even though I'd hope no one wrote the
former in an actual completion function). Which I think is what your
patch accomplishes (the -s and -w would be gobbled up and then the loop
ends at either the ":" or the -q whichever comes first).
next prev parent reply other threads:[~2015-09-28 23:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-28 16:55 Jun T.
2015-09-28 23:48 ` Bart Schaefer [this message]
2015-09-29 16:12 ` Jun T.
2015-09-29 20:41 ` Bart Schaefer
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=150928164855.ZM29167@torch.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=zsh-workers@zsh.org \
/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).