Hey! I get stuck trying to implement completion script for strings containing 
two parts for completion delimited by '%' sign.  For example, `cmd opt%arg`. 
The problem is that, if i hit tab key, when cursor is behind delimeter, bash 
eats first part of string leaving `cmd arg`. I just can't understand why, for 
example `cmd -opt=arg` works just fine, and `cmd opt%arg` is not. What is the 
difference?

I also wrote the simple script to demonstrate the issue:
---------------------------------------------------------
_zz()
{
    COMPREPLY=()
    local cur="${COMP_WORDS[COMP_CWORD]}"
    if [[ "$cur" == ?*%* ]]; then
        cur="${cur#*%}"
        COMPREPLY=( $( compgen -W 'abc bbb cde' -- "$cur" ) )
        return 0
    fi

    compopt -o nospace
    COMPREPLY=( $(compgen -W 'xxx yyy zzz' -- "$cur") )
} && complete -F _zz zz
---------------------------------------------------------

'_init_completion -n %' does not solve the issue either.

-- Igor

_______________________________________________
Bash-completion-devel mailing list
Bash-completion-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/bash-completion-devel

Reply via email to