bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [BUG][bash][auto completion] if COMPREPLY contents ":" auto completi


From: Paul Jarc
Subject: Re: [BUG][bash][auto completion] if COMPREPLY contents ":" auto completion doesn't work properly
Date: Tue, 26 Sep 2006 17:04:46 -0400
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.4 (gnu/linux)

Chet Ramey <chet.ramey@case.edu> wrote:
>> Chet Ramey <chet.ramey@case.edu> 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 "${COMP_WORDS[@]}" reply 
> "${COMPREPLY[@]}"
>   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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]