bug-bash
[Top][All Lists]
Advanced

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

Re: [RFC] support 'COMP_WORDBREAKS' value on a per-completion basis


From: Raphaël Droz
Subject: Re: [RFC] support 'COMP_WORDBREAKS' value on a per-completion basis
Date: Sat, 24 Dec 2011 13:34:11 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Mon, Aug 22, 2011 at 11:22:36AM +0200, Raphaël Droz wrote:
> On Thu, Jun 23, 2011 at 10:49:20AM -0400, Chet Ramey wrote:
> > On 5/30/11 2:05 PM, Raphaël Droz wrote:
> > > === 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...
> > 
> > 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 `:'.
> 
> would you have any advise to give for a lighter solution ?
> Isn't rl_completion_word_break_hook the way to go ?

I still have the two same questions.

I also gave a look at completions and the COMP_WORDBREAKS behavior
disturbs the following completions:
* any URL/host for commands supporting several protocols (colon separated)
* some mount options
* cpan2dist --format option (Perl::module::name)
* setxkbmap -option option

But I can see a workaround which may consist in saving COMP_WORKBREAKS
before the completion is called, and restoring its value (still within
bash) after the completion happened, so that programmable completion can
change its value without trouble. Would it be better ?



reply via email to

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