Re: Zsh completion regression
- From
SZEDER Gábor <szeder@ira.uka.de>
- Date
- Jan 14, 2012, 15:20 UTC
- Message-ID
- <20120114152030.GX30469@goldbirke>
- In-Reply-To
- <vpq7h0ufj87.fsf@bauges.imag.fr>
Hi,
On Sat, Jan 14, 2012 at 03:32:08PM +0100, Matthieu Moy wrote:
Show 21 quoted lines
> SZEDER Gábor <szeder@ira.uka.de> writes:
> > We could fix the regression by not appending a space suffix to
> > completion words in __gitcomp_nl(), but only when the completion
> > script is running under zsh to avoid hurting bash users, like this:
> >
> > diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> > index 2d02a7f3..49393243 100755
> > --- a/contrib/completion/git-completion.bash
> > +++ b/contrib/completion/git-completion.bash
> > @@ -601,6 +601,9 @@ __gitcomp_nl ()
> > suffix="$4"
> > fi
> > fi
> > + if [ -n "${ZSH_VERSION-}" ] && [ "$suffix" = " " ]; then
> > + suffix=""
> > + fi
> >
> > IFS=$s
> > COMPREPLY=($(compgen -P "${2-}" -S "$suffix" -W "$1" -- "$cur_"))
>
> I hate to see special case for different shells,I agree and thought about that, too. We are dealing with zsh quirks in the completion script either by
- having whole functions with different definitions in zsh and in bash (currently__git_shopt() and _get_comp_words_by_ref()), or - having similar shell-specific cases inside functions (currently _git() and _gitk()).
We use the former when the implementations for the two shells differ significantly, and the latter when the shell-specific parts are small and most of the function's implementation can be used in both shells. I think this regression fix fits into the latter category.
> but if no one finds a > better solution, then yes, this is the way to go. Not having the space > may be irritating, but having the quoted space hurts really much more (I > have to delete the space and the backslash manually to continue).
I have no better idea for fixing this regression, and no idea at all for a proper fix (i.e. to make zsh behave the same way in this respect as bash). I can imagine that it's irritating, that's why I aimed for this minimal regression fix, which, maybe with a Tested-by from you or Stefan, can even go into maint, so affected users can get it faster.
Best, Gábor