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 12, 2012, 14:56 UTC
Message-ID
<vpq62ghj7fn.fsf@bauges.imag.fr>
In-Reply-To
<1kdr5xk.1sopzul1hygnbrM%lists@haller-berlin.de>
lists@haller-berlin.de (Stefan Haller) writes:
> I'm using zsh   4.3.11.
>
> When I type "git log mas<TAB>", it completes to "git log master\ " (a
> backslash, a space, and then the cursor).
Same here (although I've been too lazy to bisect myself).
The following patch makes the situation better, but is not really a fix:
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -525,7 +525,7 @@ __gitcomp ()
 __gitcomp_nl ()
 {
        local s=$'\n' IFS=' '$'\t'$'\n'
-       local cur_="$cur" suffix=" "
+       local cur_="$cur" suffix=""
 
        if [ $# -gt 2 ]; then
                cur_="$3"

With this, the trailing space isn't added, but e.g. "git checkout
master<TAB>" does not add the trailing space, at all.

The problem is a little bit below:

	IFS=$s
	COMPREPLY=($(compgen -P "${2-}" -S "$suffix" -W "$1" -- "$cur_"))

The -S "$suffix" adds a space to the completion, but ZSH escapes the
space (which sounds sensible in general, but is not at all what we
expect). My completion-fu isn't good enough to get any further either
unfortunately.
-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Previous: Stefan HallerNext: SZEDER Gábor
Message 2 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.