Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Strange completion display with wrong matcher-list



Is the following a bug in zsh?
I have in my .zshrc:

zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}'

I had copied it somewhere from the net, but it seems
to me now that the first entry (the empty string) is buggy.
However, instead of an error message or reliably wrong behaviour,
it triggers a very strange thing.

For some(!) completion functions in some(!) zsh versions,
when I press "tab" twice, the display of the options is broken.
Below is a minimal example of a completion file which breaks with
zsh-5.3.1 and the above zstyle.

Note that very subtle changes to the function
(e.g. replacing ->cmds directly by _files)
avoid the problem.
Or maybe the function is using -> in a broken manner?

The behavior is this: After pressing "my -<tab><tab>" I see
something unreadable like (in this case)

--long
-s
-- an option
--long
-s
-- an option

instead of the expeected

--long  -s  -- an option

Here is the (broken?) completion file:

#compdef my
local curcontext="$curcontext" state state_descr line
typeset -A opt_args
_arguments -C : \
{'(--long)-s','(-s)--long'}'[an option]' \
'1:an arg:->cmds'
local ret=$?
case $state in
(cmds)
	_files
	ret=$?;;
esac
return ret



Messages sorted by: Reverse Date, Date, Thread, Author