[Top][All Lists]

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

Re: completion in var=$(cmd1) cmd2 <tab>

From: Chet Ramey
Subject: Re: completion in var=$(cmd1) cmd2 <tab>
Date: Sat, 17 Dec 2011 12:50:01 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:8.0) Gecko/20111105 Thunderbird/8.0

On 12/11/11 3:41 PM, Raphaël Droz wrote:
> Example:
> $ var=$(id) foo <tab>
> completes with completion matches from id(1)
> This is problematic for cases like:
> LD_LIBRARY_PATH=$(find ...) cmd --<tab>
> where options are those from find(1).
> I didn't looked deeper but I guess the faulty part is in
> _rl_find_completion_word() which, as its name suggest, *should* find the
> word to be completed instead of returning rl_point as-is (14 in the
> above case)

That's not the problem; that *is* the (empty) word to be completed.

The problem isn't with readline, it's with the code that identifies the
command name in the command to be completed for use by programmable
completion.  There are two problems: the code that identifies the start
of the command has to skip over command substitutions, and the code that
slices up the identified command string into words has to skip over
assignment statements when deciding which word is the command name.  The
next version of bash will be better at doing that.


``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/

reply via email to

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