[Top][All Lists]

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

Re: Tab completion and ':'s

From: Vadim Berezniker
Subject: Re: Tab completion and ':'s
Date: Fri, 14 Nov 2014 21:57:59 +0000

On Fri Nov 14 2014 at 2:47:04 PM Chet Ramey <chet.ramey@case.edu> wrote:

> On 11/14/14, 10:49 AM, Vadim Berezniker wrote:
> > Thanks for the reply Chet,
> >
> > The completer is being setup in Bash, not directly through readline
> (sorry
> > if I wasn't detailed enough in my original post).
> > Even though readline might break the completion on the ':', we can use
> > COMP_LINE/COMP_POINT to figure out the URL that needs to be completed
> > (ignoring the ':').
> OK, I see.  You can also use the arguments passed to the completion
> function or the COMP_WORDS array to see readline's idea of the previous
> word and use that as the prefix.

> > The problem of course is inserting the results. No matter what we return
> > from the completer, readline is going to insert it after the ':' which
> > means we have to strip off everything up to ':' in the completion
> results.
> Yes.  Something like "${results[@]/${prefix}/}" can be useful there,
> assuming you put the possible completions into a `results' array and
> build $prefix as described above.


> > If the completer had a way to tell readline (through Bash) where the
> > completion should be inserted that would allow a workaround for this
> issue
> > without requiring any actions from the user.
> It's not only that, but the text that would have to be removed from the
> buffer (the `previous' word) before inserting any possible completions,
> and making sure that text isn't removed from the line inappropriately.
Correct. Is that feasible? It looked doable from my look through the bash &
readline code, but I don't have a lot of familiarity with intricacies of
Would there be interest in a patch that would implement such a feature?

Thank you

> Chet
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>                  ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~
> chet/

reply via email to

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