[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: A programmable completoin bug?
From: |
Chet Ramey |
Subject: |
Re: A programmable completoin bug? |
Date: |
Sun, 04 Dec 2011 22:10:07 -0500 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:8.0) Gecko/20111105 Thunderbird/8.0 |
On 12/4/11 9:39 PM, Clark J. Wang wrote:
> On Sat, Dec 3, 2011 at 09:32, Chet Ramey <address@hidden
> <mailto:address@hidden>> wrote:
>
> On 11/30/11 2:08 AM, Clark J. Wang wrote:
> > (Tested with bash 4.2.10 and 4.1.9)
> >
> > [bash-4.2.10] # cat foo.compspec
> > compspec_foo()
> > {
> > local cmd=$1 cur=$2 pre=$3
> >
> > if [[ $cur = :* ]]; then
> > COMPREPLY=( changed changed/IGNORE_ME )
> > fi
> > }
> >
> > complete -F compspec_foo foo
> > [bash-4.2.10] # source foo.compspec
> > [bash-4.2.10] # foo :short<TAB>
> > [bash-4.2.10] # foo changed <-- Fine, this is what I want
> > [bash-4.2.10] # foo :this-is-a-long-word<TAB>
> > [bash-4.2.10] # foo :this-i <-- Bug here?
> >
>
> First of all, you must have removed `:' from $COMP_WORDBREAKS, because
> you won't get any matches unless you have.
>
>
> Sorry I forgot to mention that. `:' is removed from $COMP_WORDBREAKS in my
> global rc files. To be more exact:
>
> [bash-4.2.10] # printf '%q\n' "$COMP_WORDBREAKS"
> $' \t\n"\'><=;|&('
> [bash-4.2.10] #
>
>
> I can't reproduce this behavior using bash-4.2.20 (after modifying
> COMP_WORDBREAKS); I get `changed' as the completion in both cases.
>
>
> I just compiled the latest 4.2.20 and I could still reproduce it. And I
> also tested in Cygwin (bash 4.1.10) and Debian 6.0 (bash 4.1.5), they all
> have the same problem.
I still can't reproduce it on Mac OS X or RHEL 5.7:
$ echo $BASH_VERSION
4.2.20(8)-release
$ type -a compspec_foo
compspec_foo is a function
compspec_foo ()
{
local cmd=$1 cur=$2 pre=$3;
if [[ $cur = :* ]]; then
COMPREPLY=(changed changed/IGNORE_ME);
fi
}
$ complete
complete -F compspec_foo foo
$ set -x
$ COMP_WORDBREAKS=${COMP_WORDBREAKS%?}
+ COMP_WORDBREAKS='
"'\''@><=;|&('
$ echo $COMP_WORDBREAKS
+ echo '"'\''@><=;|&('
"'@><=;|&(
$ foo :this-is-a-+ local cmd=foo cur=:this-is-a- pre=foo
+ [[ :this-is-a- = :* ]]
+ COMPREPLY=(changed changed/IGNORE_ME)
changed
+ foo changed
bash: foo: command not found
$ foo :this-is-a-long-word+ local cmd=foo cur=:this-is-a-long-word pre=foo
+ [[ :this-is-a-long-word = :* ]]
+ COMPREPLY=(changed changed/IGNORE_ME)
changed
+ foo changed
bash: foo: command not found
I wonder if there's some difference in our environments that's the cause.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU address@hidden http://cnswww.cns.cwru.edu/~chet/
- Re: A programmable completoin bug?, Chet Ramey, 2011/12/02
- Re: A programmable completoin bug?, Clark J. Wang, 2011/12/04
- Re: A programmable completoin bug?,
Chet Ramey <=
- Re: A programmable completoin bug?, Clark J. Wang, 2011/12/04
- Re: A programmable completoin bug?, Chet Ramey, 2011/12/04
- Re: A programmable completoin bug?, Clark J. Wang, 2011/12/05
- Re: A programmable completoin bug?, Clark J. Wang, 2011/12/05
- Re: A programmable completoin bug?, Chet Ramey, 2011/12/06