Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
3 of 5 tasks
HIDE-r opened this issue Mar 25, 2024 · 4 comments
Open
3 of 5 tasks

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

HIDE-r opened this issue Mar 25, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@HIDE-r
Copy link

HIDE-r commented Mar 25, 2024

Describe the bug

A clear and concise description of what the bug is.

I can make sure:

  • I am using the latest version of fzf-tab
  • this is the minimal zshrc which can reproduce this bug
  • fzf-tab is loaded after compinit
  • fzf-tab is loaded after plugins which will wrap Tab, like junegunn/fzf/completion.zsh
  • fzf-tab is loaded before zsh-autosuggestions, zsh-syntax-highlighting and fast-syntax-highlighting.

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:

  • OS: Arch Linux
  • zsh version: 5.9 (x86_64-pc-linux-gnu)

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

@HIDE-r HIDE-r added the bug Something isn't working label Mar 25, 2024
@HIDE-r HIDE-r changed the title [BUG] completion is mess when no use double hyphen [BUG] completion is mess when _describe no use double hyphen Mar 25, 2024
@HIDE-r HIDE-r changed the title [BUG] completion is mess when _describe no use double hyphen [BUG] completion is mess when _describe use alias description array Mar 25, 2024
@HIDE-r HIDE-r changed the title [BUG] completion is mess when _describe use alias description array [BUG] completion is mess when _describe use alternative array Mar 25, 2024
@Aloxaf
Copy link
Owner

Aloxaf commented Mar 26, 2024

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
Copy link
Author

HIDE-r commented Mar 27, 2024

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

@Aloxaf
Copy link
Owner

Aloxaf commented Apr 1, 2024

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
Copy link
Owner

Aloxaf commented Apr 24, 2024

Temporary workaround for anyone encountering this problem:

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants