git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

Previous: Matthieu MoyNext: Matthieu Moy
Message 5 of 21 in “Zsh completion regression”
  1. Stefan HallerJan 12, 2012
  2. Matthieu MoyJan 12, 2012
  3. SZEDER GáborJan 14, 2012
  4. Matthieu MoyJan 14, 2012
  5. SZEDER GáborJan 14, 2012
  6. bash-completion: don't add quoted space for ZSH (fix regression)Matthieu Moy, Jan 14, 2012
  7. Junio C HamanoJan 15, 2012
  8. Matthieu MoyJan 16, 2012
  9. Junio C HamanoJan 16, 2012
  10. Matthieu MoyJan 17, 2012
  11. Junio C HamanoJan 17, 2012
  12. Felipe ContrerasJan 17, 2012
  13. Felipe ContrerasJan 17, 2012
  14. Junio C HamanoJan 17, 2012
  15. Felipe ContrerasJan 17, 2012
  16. Junio C HamanoJan 17, 2012
  17. Matthieu MoyJan 18, 2012
  18. Felipe ContrerasJan 25, 2012
  19. Junio C HamanoJan 25, 2012
  20. Stefan HallerJan 14, 2012
  21. Stefan HallerJan 14, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.