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

Fix zsh completion handling of nospace and file completion #1213

Merged
merged 1 commit into from May 3, 2021

Commits on Feb 19, 2021

  1. Fix zsh for DirectiveNoSpace and DirectiveNoFileComp

    Fixes spf13#1211
    
    When handling ShellCompDirectiveNoSpace we must still properly handle
    descriptions.  To do so we cannot simply use 'compadd', but must use
    zsh's '_describe' function.
    
    Also, when handling ShellCompDirectiveNoSpace we cannot assume that
    only a single completion will be given to the script.  In fact,
    ValidArgsFunction can return multiple completions, even if they don't
    match the 'toComplete' argument prefix.  Therefore, we cannot use the
    number of completions received in the completion script to determine
    if we should activate the "no space" directive.  Instead, we can leave
    it all to the '_describe' function.
    
    Fixes spf13#1212
    
    When handling ShellCompDirectiveNoFileComp we cannot base ourself on
    the script receiving no valid completion. In fact,
    ValidArgsFunction can return multiple completions, even if they don't
    match the 'toComplete' argument prefix at all.  Therefore, we cannot use
    the number of completions received by the completion script to determine
    if we should activate the "no file comp" directive.  Instead, we can
    check if the '_describe' function has found any completions.
    
    Finally, it is important for the script to return the return code of the
    called zsh functions (_describe, _arguments).  This tells zsh if
    completions were found or not, which if not, will trigger different
    matching attempts, such as matching what the user typed with the the
    content of possible completions (instead of just as the prefix).
    
    Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
    marckhouzam committed Feb 19, 2021
    Copy the full SHA
    35d352e View commit details
    Browse the repository at this point in the history