From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14627 invoked by alias); 25 Jan 2012 00:50:46 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 30124 Received: (qmail 27263 invoked from network); 25 Jan 2012 00:50:45 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,RCVD_IN_DNSWL_LOW, T_DKIM_INVALID,T_TO_NO_BRKTS_FREEMAIL autolearn=no version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.215.43 as permitted sender) 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= MIME-Version: 1.0 Date: Wed, 25 Jan 2012 02:43:40 +0200 Message-ID: Subject: Bug with bash completion emulation From: Felipe Contreras To: zsh-workers@zsh.org Content-Type: text/plain; charset=UTF-8 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', 'foo s', 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