[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC] support 'COMP_WORDBREAKS' value on a per-completion basis
From: |
Chet Ramey |
Subject: |
Re: [RFC] support 'COMP_WORDBREAKS' value on a per-completion basis |
Date: |
Thu, 23 Jun 2011 10:49:20 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.17) Gecko/20110414 Lightning/1.0b2 Thunderbird/3.1.10 |
On 5/30/11 2:05 PM, Raphaël Droz wrote:
> It seems like if address@hidden eat the first occurrence
> of this email (not in the mailman archives)... second attempt:
>
> === Rationale:
> Let's say you want to complete http URL (which contain ':').
>
> The completion probably contains this kind of statement:
>
> _comp() {
> COMPREPLY=( $(compgen -W "http://foo http://bar" -- "$cur") )
> }
>
> After the completion function is evaluated, readline will consider
> the value of $COMP_WORDBREAKS to split the word to complete...
I sent an earlier message explaining how this explanation was slightly
wrong, but I looked at the patches and they do the right thing. The
patch attempts to determine the command name before readline performs
its wordbreak processing, and installs a new value for the set of word
break characters before that happens.
The question that comes to mind is whether or not this complication is
worth it. This seems like a pretty heavyweight solution to an
occasional problem with `:'. The best approach might be to remove the
colon from the default set of word break characters. I have to think
that the number of users completing colon-separated path values is
smaller than the number attempting to complete URLs.
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/