* Bug with bash completion emulation
@ 2012-01-25 0:43 Felipe Contreras
0 siblings, 0 replies; only message in thread
From: Felipe Contreras @ 2012-01-25 0:43 UTC (permalink / raw)
To: zsh-workers
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2012-01-25 0:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-25 0:43 Bug with bash completion emulation Felipe Contreras
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).