Description:
    I don't know if this is a bug or not, but it has to do with programmable
auto completion. Whenever the options have multiple words I don't get what I
want.
    Here is an example, just for show:

    f() {
        COMPREPLY=""
        c=0
        while read line; do
            COMPREPLY[$c]=$line
            c=$[$c + 1]
        done <<< "$(compgen -W "a\ b a\ b\ c b" --
${COMP_WORDS[COMP_CWORD]})"
    }
    complete -F f lala

    now watch this:

    [EMAIL PROTECTED] ~ $ lala <TAB><TAB>
    a b   a b c  b
    [EMAIL PROTECTED] ~ $ lala

    This is what I expected, but now, if I do:

    [EMAIL PROTECTED] ~ $ lala a<TAB>

    I will get:

    [EMAIL PROTECTED] ~ $ lala a b

    while I expected

    [EMAIL PROTECTED] ~ $ lala a\ b

    as auto-completion normaly does with file names.

    I "fixed" this by changing one line of the function f. The new line is:

    COMPREPLY[$c]=${line// /\\ }

    But now, I get this:

    [EMAIL PROTECTED] ~ $ lala <TAB><TAB>
    a\ b   a\ b\ c   b
    [EMAIL PROTECTED] ~ $ lala

    So, what I want to know is: is there any way to have the spaces escaped
when completing a word, but not when showing the completion options
(COMPREPLY)?

    If so, please, tell me how. If not, well, I've found a bug :P

    Thank you in advance,
    Daniel Fleischman.

Repeat-By:
    1) Type the "f" function
    2) write "lala a<TAB>" on bash

Reply via email to