zsh-workers
 help / color / mirror / code / Atom feed
* [BUG] Any type of file in command position gets misleadingly completed as 'executable file'
@ 2021-11-10 21:59 Marlon Richert
  2021-11-10 22:34 ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Marlon Richert @ 2021-11-10 21:59 UTC (permalink / raw)
  To: Zsh hackers list

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-11-11 13:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-10 21:59 [BUG] Any type of file in command position gets misleadingly completed as 'executable file' Marlon Richert
2021-11-10 22:34 ` Bart Schaefer
2021-11-11  1:41   ` Oliver Kiddle
2021-11-11 13:51     ` Oliver Kiddle

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