Zsh Mailing List Archive
Messages sorted by:
Re: [Bug] Doubled completions with suffix aliases and grouping
- X-seq: zsh-workers 46198
- From: Guido Cella <guidocella91@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: [Bug] Doubled completions with suffix aliases and grouping
- Date: Tue, 7 Jul 2020 08:57:41 +0200
- Cc: "zsh-workers@xxxxxxx" <zsh-workers@xxxxxxx>
- In-reply-to: <CAH+w=7ZFUwYrguy6L5_N3NTGSiYPChgsFwmpFpmJ18-10+LX+A@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>
- List-unsubscribe: <mailto:email@example.com>
- Mail-followup-to: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, "zsh-workers@xxxxxxx" <zsh-workers@xxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <firstname.lastname@example.org> <CAH+w=7aXs_UYoHLqxYzXtCGacUoFxYpqNoZXBq=ofpsMa6RZ7w@mail.gmail.com> <email@example.com> <CAH+w=7ZFUwYrguy6L5_N3NTGSiYPChgsFwmpFpmJ18-10+LX+A@mail.gmail.com>
- Sender: zsh-workers@xxxxxxx
On Mon, Jul 06, 2020 at 09:51:06PM -0700, Bart Schaefer wrote:
> On Sun, Jul 5, 2020 at 12:24 PM Guido Cella <guidocella91@xxxxxxxxx> wrote:
> > I think that the bug is adding files that aren't executable to the
> > "executable file" grouping.
> Aye, well, that's not exactly a bug either. The position taken when
> developing the completion code was that it's always better to offer
> something that the user might possibly mean rather than to offer
> nothing; i.e., err on the side of too much information rather than too
> little. Because _command_names uses _alternative, the two branches
> (executables and suffix-aliases) don't "know" that the other might
> produce overlapping matches, so each generates its result
> independently, and when executables finds nothing, it falls back to
> all files.
> There are two elements of your specific example that could potentially
> be considered bugs. The first is that there's no file-patterns zstyle
> for the "executables" tag; the closest you can get is to set one for
> the :completion:complete:-command-:: context. The second is that this
> doesn't work:
> zstyle :completion::complete:-command-::executables ignored-patterns '*(^*)'
> Instead you have to do this:
> zstyle :completion::complete:-command-::executables ignored-patterns '*(#q^*)'
> However, I think you'll find if you do that latter, you'll get what you want.
I agree that it's better to complete all files rather than to offer
nothing, my problem is that it completes all files again even when
suffix aliases do offer matches.
zstyle :completion::complete:-command-::executables ignored-patterns '*(#q^*)'
is worse since it stops completing directories (and real executables)
when there's matching suffix alias. :/
Only foo.txt is completed.
Anyway, by navigating the completion code I could guess fixing this
would require changing the code too much because executables and suffix
aliases are completed from different places. I only enabled grouping so
I could set list-dirs-first and have suffix aliases for everything, so
it's annoying to get double completions, even of many files, each time I
browse a leaf directory.
Messages sorted by: