Chet Ramey <[EMAIL PROTECTED]> wrote:
>> Chet Ramey <[EMAIL PROTECTED]> wrote:
>> Also, after two tabs, we have "qwe:qwe:o", but further tabs don't add
>> any more "qwe:"'s for some reason I don't understand.
>
> Because the colon is still a word break character, and readline passes `o'
> to the completion function as the partial word to be completed.

I added some echos to the completion function to check, and I see
something different.

$ echo "$COMP_WORDBREAKS"
 
"'><=;|&(:
$ _myfunc() {
>   local cur=${COMP_WORDS[COMP_CWORD]}
>   COMPREPLY=( $(compgen -W "qwe:on qwe:off" -- "$cur") )
>   echo
>   echo
>   printf '>%s<\n' cword "$cur" words "[EMAIL PROTECTED]" reply "[EMAIL 
> PROTECTED]"
>   echo
> }
$ complete -F _myfunc myfunc
$ myfunc <TAB>

>cword<
><
>words<
>myfunc<
><
>reply<
>qwe:on<
>qwe:off<

$ myfunc qwe:o<TAB>

>cword<
>qwe:o<
>words<
>myfunc<
>qwe:o<
>reply<
>qwe:on<
>qwe:off<

$ myfunc qwe:qwe:o<TAB>

>cword<
>qwe:qwe:o<
>words<
>myfunc<
>qwe:qwe:o<
>reply<

So it looks like the entire word is passed to the completion function;
COMP_WORDBREAKS is not consulted at that point.  COMP_WORDBREAKS is
only used to decide how much text to erase before inserting the
completion text.  Is that intended?  Is the completion function
supposed to take care of splitting the word if it wants that?


paul


_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash

Reply via email to