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: Chet Ramey
Subject: Re: [BUG][bash][auto completion] if COMPREPLY contents ":" auto completion doesn't work properly
Date: Wed, 27 Sep 2006 11:26:43 -0400

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

I think you (and the author of the completion function) misinterpreted
the intended results.  The COMP_WORDS array is an array of the words
on the command line, split as the shell would split them during
parsing.  That's intended to allow function writers to see the words
of the command as they would eventually be parsed.  The second
argument to the shell function ($2) is the word being completed, and
that is as readline breaks the words.  The nature of COMP_WORDS isn't
as clear as it could be made in the bash documentation, but that can
be changed. 

Readline's behavior when splitting words for the completer can be intuited
from the difference, if any, between $2 and ${COMP_WORDS[$COMP_CWORD]}.  That
can give the function writer greater context.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                                Live Strong.
Chet Ramey, ITS, CWRU    chet@case.edu    http://tiswww.tis.case.edu/~chet/




reply via email to

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