From: Marlon Richert <marlon.richert@gmail.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: [BUG] Any type of file in command position gets misleadingly completed as 'executable file'
Date: Wed, 10 Nov 2021 23:59:35 +0200 [thread overview]
Message-ID: <CAHLkEDtscOXas+-Wwj68O29H3_JrKycZ8Rr3wCovnxqk=ioOzg@mail.gmail.com> (raw)
% zsh -f
% autoload compinit; compinit
% zstyle '*' format '%d'
% zstyle '*' group-name ''
% mkdir foo
% foo^D
executable file
foo/
% touch bar
% bar^D
executable file
bar
The problem is in _files and it is two-fold:
* _files always adds '*:all-files', which ignores the pattern passed
with the -g flag.
* Even though _files passes its file pattern tags to _next_label, if
_files was passed a tag and/or description, it _always_ prefers these
over the ones returned by _next_label's call to _description.
I propose fixing this as follows:
* _files should not add '*:all-files'. Why would anyone want
_non-matching_ files to be listed?
* The 'globbed-files' tag should be renamed to just 'files' and have a
default description of 'file'. (As an aside, the docs speak of an
'other-files' tag used when zstyle list-directories-first is set, but
this is never actually offered. Let's remove that, too.)
* If _files was passed a tag and/or a description, then these should
replace the 'files' tag (formerly 'globbed-files') and its
description, respectively -- but not the 'directories' tag and/or its
description -- and these should be passed to _next_label.
* For each tag and description that _files passes to _next_label, it
should always prefer the resulting "$expl[@]" over "$opts[@]" when
calling _path_files.
This way:
* Directories will always be listed as directories, unless overridden
through the zstyles supported by _description.
* Any tag and/or description passed to _files will be used to override
only the 'files' tag and its description, and these will be passed to
_description.
* Non-matching files will not be listed.
next reply other threads:[~2021-11-10 22:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-10 21:59 Marlon Richert [this message]
2021-11-10 22:34 ` Bart Schaefer
2021-11-11 1:41 ` Oliver Kiddle
2021-11-11 13:51 ` Oliver Kiddle
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='CAHLkEDtscOXas+-Wwj68O29H3_JrKycZ8Rr3wCovnxqk=ioOzg@mail.gmail.com' \
--to=marlon.richert@gmail.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).