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

Re: Zsh completion regression

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
Jan 14, 2012, 14:32 UTC
Message-ID
<vpq7h0ufj87.fsf@bauges.imag.fr>
In-Reply-To
<20120114132343.GW30469@goldbirke>
SZEDER Gábor <szeder@ira.uka.de> writes:
Show 6 quoted lines
>> but e.g. "git checkout
>> master<TAB>" does not add the trailing space, at all.
>
> I'm not sure what you mean; did you got a trailing space after
> 'master<TAB>' before a31e6262 (completion: optimize refs completion,
> 2011-10-15)?

No. My above sentence should read "... not add the trailing space, at all, even for bash users". IOW, your understanding is correct.

Show 18 quoted lines
> 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, 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).

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Previous: SZEDER GáborNext: SZEDER Gábor
Message 4 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.