Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Bug with bash completion emulation
- X-seq: zsh-workers 30124
- From: Felipe Contreras <felipe.contreras@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Bug with bash completion emulation
- Date: Wed, 25 Jan 2012 02:43:40 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=2wFqTPdgVPCpr/l05rJA7MhZlcP/rO2XVfIlnDNMxPw=; b=WeEaabwACnLLDN0Cm7Y+x1r2jttVlt1aAMFk4lfsj2UQm7YFACuv5pjpCrFbVlMtB2 SXQdhQLO9E3EUtPPZmovYbBwwfzMXzPbBTwGPONE9oiyQ7zjcexd5qCmAoMuUUId6JJg /wOmg3UxKjnjSMLp6TVQX3nvdtSlund0+S0Sg=
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
Hi,
The following script shows a problem that happens with git's bash completion:
---
#!/bin/sh
if [[ -n ${ZSH_VERSION-} ]]; then
autoload -U +X bashcompinit && bashcompinit
fi
_foo()
{
local cur="${COMP_WORDS[COMP_CWORD]}"
local IFS=$'\n'
w[0]='first '
w[1]='second and space '
w[2]='third\\ quoted\\ space '
COMPREPLY=( $(compgen -W "${w[*]}" -- $cur) )
}
complete -o nospace -F _foo foo
---
The result in bash (by typing 'foo f<tab>', 'foo s<tab>', and so on) is:
'foo first '
'foo second and space '
'foo third\ quoted\ space '
In zsh, the results are quite different:
'foo first\ '
'foo second\ and\ space\ '
'foo third\ quoted\ space\ '
The following patch improves the results for me, but I get 'foo
third\\ quoted\\ space ', which is still not correct.
Any ideas?
---
--- bashcompinit 2012-01-25 00:20:54.933054267 +0200
+++ bashcompinit 2012-01-25 02:34:24.795667889 +0200
@@ -26,7 +26,7 @@
compset -S '/*' && matches=( ${matches%%/*} )
compadd -f "${suf[@]}" -a matches && ret=0
else
- compadd "${suf[@]}" -a matches && ret=0
+ compadd -Q "${suf[@]}" -a matches && ret=0
fi
fi
@@ -160,7 +160,7 @@
#shift $(( OPTIND - 1 ))
#(( $# )) && results=( "${(M)results[@]:#$1*}" )
- print -l -- "$prefix${^results[@]}$suffix"
+ print -l -r -- "$prefix${^results[@]}$suffix"
}
complete() {
---
--
Felipe Contreras
Messages sorted by:
Reverse Date,
Date,
Thread,
Author