Re: [PATCH] git-completion: fix zsh support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Apr 27, 2011 at 7:55 AM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> Jonathan Nieder <jrnieder@xxxxxxxxx> writes:
>
>> Felipe Contreras wrote:
>>
>>> It turns out 'words' is a special variable used by zsh completion, and
>>> it has some strange behavior as we can see.
>>>
>>> Better avoid it.
>>
>> Hoorah! ÂI imagine this fixes a regression introduced by
>> v1.7.4-rc0~11^2~2 (bash: get --pretty=m<tab> completion to work with
>> bash v4, 2010-12-02).
>>
>> ÂAcked-by: Jonathan Nieder <jrnieder@xxxxxxxxx>
>
> I'd love to share the enthusiasm, but find that "as we can see" needs a
> much more clarification.

Jonathan already described it:
http://article.gmane.org/gmane.comp.version-control.git/170665

And this snipped demonstrates it:
---
set_vars ()
{
	cur="foo"
	words="foo"
	cwords="foo"
}

_foo ()
{
	local cur words cwords
	set_vars

	echo "cur=${cur} words=${words} cwords=${cwords}" >> /tmp/comp_test.txt
}

compdef _foo foo
---

When trying to auto-complete 'foo' the result would be:
  cur=foo words= cwords=foo

You can see it's special in the source code:
http://zsh.git.sourceforge.net/git/gitweb.cgi?p=zsh/zsh;a=blob;f=Src/Zle/complete.c;h=6398fd3e77eff2ef819c10503d316b08421034ac;hb=HEAD#l1116

-- 
Felipe Contreras
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]