Aloxaf / fzf-tab

Replace zsh's default completion selection menu with fzf!
MIT License
2.98k stars 90 forks source link

[BUG] completion is mess when _describe use alternative array #424

Open HIDE-r opened 3 months ago

HIDE-r commented 3 months ago

Describe the bug

A clear and concise description of what the bug is.

I can make sure:

To Reproduce

Steps to reproduce the behavior:

  1. Type 'cmd '
  2. Press Tab
  3. See error
Lenovo-R9000K% cat $HOME/test_zshrc
fpath=($HOME/.fpath $fpath)

autoload -U compinit; compinit
source ~/somewhere/fzf-tab.plugin.zsh
Lenovo-R9000K% cat $HOME/.fpath/_cmd
#compdef cmd

local -a subcmds topics
subcmds=('c:description for c command' 'd:description for d command')
# topics=('e:description for e help topic' 'f:description for f help topic')
topics=('c:description for c command' 'd:description for d command')
_describe 'command' subcmds topics
❯ git clone https://github.com/Aloxaf/fzf-tab ~/somewhere
❯ zsh -d -f
Lenovo-R9000K% source test_zshrc
Lenovo-R9000K% cmd c:description\ for\ c\ command 

asciicast

Expected behavior

There should be no extra characters('description\ for\ c\ command')

Screenshots

If applicable, add screenshots to help explain your problem.

Environment:

Minimal zshrc

Lenovo-R9000K% cat $HOME/test_zshrc
fpath=($HOME/.fpath $fpath)

autoload -U compinit; compinit
source ~/somewhere/fzf-tab.plugin.zsh

Log

zsh-48936-fzf-tab-1.log

Aloxaf commented 3 months ago

This bug can be reproduced without fzf-tab:

> autoload -U compinit; compinit
_tst() {
    local -a subcmds topics
    subcmds=('c:description for c command' 'd:description for d command')
    topics=('c:description for c command' 'd:description for d command')
    _describe 'command' subcmds topics
}
compdef _tst tst
zstyle ':completion:*' menu yes select search
zstyle ':completion:*' list-grouped false

> tst # press tab here

Quite strange, it may be a bug of _describe or compsys.

HIDE-r commented 3 months ago

Maybe. It looks strange. What should I do about this issue next? report to zsh?

Aloxaf commented 3 months ago

I am not sure, this seems to be a known issue:

https://github.com/zsh-users/zsh/blob/master/Completion/Base/Utility/_describe#L3-L8

Aloxaf commented 2 months ago

Temporary workaround for anyone encountering this problem:

zstyle ':completion:*:complete:networkctl:*' list-grouped true